Unity

Format: symptom, cause, fix, where it was found. Newest at the bottom.

Batch mode rejects a Personal license#

  • Symptom: BatchMode: Unity has not been activated with a valid License / Missing or bad username or password, while the GUI editor opens fine.
  • Cause: the entitlement-based Personal license isn't honoured in -batchmode (Unity 2020.3 on Windows 11).
  • Fix: run build and automation methods through the GUI editor with -executeMethod (skill unity-dev-build).
  • Found in: Alt-SAMP (SanAndreasUnity), 2026-11-19.

Exact editor version via the Unity CLI#

  • Symptom: the project wants an editor version that isn't installed.
  • Fix: unity install <version> -c <changeset> --no-cm -y. The changeset is in ProjectSettings/ProjectVersion.txt. Dry-run first to see the download size.
  • Found in: Alt-SAMP, 2026-11-18.

Licensing client timeout kills a GUI-mode build#

  • Symptom: No valid Unity Editor license found, and the editor exits within seconds even though unity license lists Unity Personal.
  • Cause: Unity 2020.3 waits ~5 s for Unity.Licensing.Client.exe. After a reboot or under load it took 12 s (log: handshake: 12.44s). Retrying alone did not help.
  • Fix: pre-start the editor's own licensing client, wait about 15 s, then open the editor. unity-dev-build's script does this.
  • Found in: Alt-SAMP rename build, 2026-11-20.

Computer-use can't target one of two Unity editors#

  • Symptom: screen control is granted to "Unity", but it resolves to the newest editor's exe, so the older editor's window is masked.
  • Fix: test through standalone builds and in-game screenshots (unity-autotest) instead of driving the editor UI.
  • Found in: Alt-SAMP, 2026-11-19.

Root GameObjects created at runtime die on scene load#

  • Symptom: MissingReferenceException every frame after a scene change, and the UI never appears.
  • Cause: a persistent component created a new root object, which was destroyed by the next LoadScene.
  • Fix: DontDestroyOnLoad the object, and rebuild it if it's null before use.
  • Found in: Alt-SAMP world-space engine sign, 2026-11-19.

World-space UI over a 3D object#

  • Approach:
    • one Canvas in RenderMode.WorldSpace, scale about 0.006,
    • billboard it with rotation = LookRotation(cam.forward, cam.up) each LateUpdate,
    • place it from the object's mesh bounds computed in its local space (8 corners of each MeshFilter.sharedMesh.bounds), so it stays centered when the object rotates.
  • Bonus: walls occlude it automatically, because UI/Default depth-tests in world space.
  • Found in: Alt-SAMP, 2026-11-19.

Mirror (networking): server-authoritative toggles#

  • Pattern:
    • the client sends the button through the existing ped button pipeline,
    • the server validates (e.g. only the driver),
    • the state lives in a [SyncVar(hook)] on the vehicle's NetworkBehaviour,
    • the hook applies it on clients.
  • Logging: log (server) / (client) on state change so multiplayer can be verified from both logs.
  • Found in: Alt-SAMP engine on/off, 2026-11-19.

Several agent sessions sharing one machine's Unity#

  • Symptom: timings swing by 10× between identical runs, builds fail the licence check, or a capture overlaps another project's batch job. A guard that only prints "Unity is running" doesn't stop anything.
  • Fix:
    • gate every Unity step (build, test, capture) in a script that waits for N consecutive 15-second checks with no Unity.exe or game player running and CPU below a threshold. Use a lower threshold for timing captures (75%) than for pass/fail tests (90%).
    • take a lock file in the shared notes folder that holds the owner's name, wait while another session holds it, and delete it after each step (with trap on EXIT).
    • log what the gate is waiting on every few minutes, so a stalled queue explains itself.
  • Also: time per-feature A/B comparisons only on a quiet machine. Discard runs taken at 100% CPU instead of reporting them.
  • Found in: Alt-SAMP Proper Shaders M2, 2026-11-20.

Built-in pipeline: lights for GTA-style 2dfx light entries#

  • Pattern: keep a static registry of active light-source components (swap-remove in OnEnable/OnDisable). A few times a second, pick the nearest N into a pool of point lights. Fade the last 25% before the cut-off distance so lights don't pop. Scale intensity by a night factor from the day/night curve.
  • Found in: Alt-SAMP map lights, 2026-11-20.

A dotnet build compile check passes code Unity rejects#

  • Symptom: the quick check (dotnet build Assembly-CSharp.csproj) succeeds, then the Unity build fails, e.g. CS0172: Type of conditional expression cannot be determined because 'Color' and 'Color32' implicitly convert to one another.
  • Cause: the .NET SDK's compiler is newer than Unity 2020.3's (C# 8) and accepts newer rules such as target-typed conditionals.
  • Fix: pass -p:LangVersion=8.0 (or the editor's version) to the quick check, cast both branches of a mixed Color/Color32 ternary, and still treat the Unity build as the real compile.
  • Found in: Alt-SAMP Godfather client, 2026-11-20.

Mirror: a player's chosen name arrives after they connect#

  • Symptom: server code that runs when a player object starts sees the default name ("Player"), and per-player data gets looked up under the wrong name.
  • Cause: the client sends its name with a [Command] from its own start-up, a few frames after the server created the player.
  • Fix: flag the player when the name command arrives (raise an event there), and hand players to name-dependent code only after that, with a short timeout for clients that never send one.
  • Found in: Alt-SAMP Godfather gamemodes, 2026-11-20.