Cause and mechanism
Gizmos draw Editor aids, such as collision shapes and ranges, in views such as the Scene view. Gizmos belongs to UnityEngine; Handles, used for editing controls, belongs to UnityEditor. For build errors, check that distinction and keep UnityEditor code out of the player build. Use runtime rendering for shapes that must appear in the game itself.
Check and correct the setup
- Find UnityEditor, Handles, and EditorUtility references in build errors. Isolate editor code or guard both imports and calls with UNITY_EDITOR.
First error, references and target environment - Enable Game view Gizmos in the editor and check the callbacks and selection conditions.
First error, references and target environment - For player-visible lines use LineRenderer, meshes, or a supported render pass. Debug.DrawLine is not a player UI solution.
First error, references and target environment
Limits and verification
Verify editor and player visibility separately. Do not move a needed runtime component entirely into an Editor folder.
A focused diagnostic setup
Start with the first Player compiler error and trace the file and assembly reference. This checks Editor-only dependencies rather than line visibility.
Test in this order
- Inspect fields, attributes, parameter types and base classes as well as using directives.
First error, references and target environment - Separate Editor features and check platform constraints and assembly-reference direction.
First error, references and target environment - Build the target Player while retaining required runtime behavior, then recheck Editor tools.
First error, references and target environment
Interpret the result
Removing one using directive leaves errors if type declarations or Runtime-to-Editor references remain. Gizmos visibility settings do not determine compilation boundaries.
Related explanations
- Fix UnityEditor reference errors after adding asmdefs
- Check Game-view gizmos and runtime debug rendering