- Home /
Using a custom icon for game objects with Gizmos.DrawIcon
I created a "DrawGizmo" script that allows me to drag and drop a custom icon onto game objects that would otherwise be invisible. It works great.
However, when I put it in a folder named "Editor" (as recommended) the script stops working; no custom gizmos in my scene and no compile errors, but the component itself says "can not be loaded". Why is this?
When that wasn't working, I pulled it back out of "Editor", but then building for iOS gives me the error
CS0246: The type or namespace name `UnityEditor' could not be found.
As a last resort, I'm considering Platform Dependent Compilation, but rather than selectively choose segments of my script to ignore, I'd like to omit the entire script from being part of the build. Is this possible?
Thanks!
Edit: Updated title to better feed search results related to my actual solution.
If you wrap the Platform Dependent Compilation tag around your entire script you will not include it in the build.
But if you could post the code for a simplified version of what you are trying to accomplish we could probably help you find the problem and solve it. This would be better solution then adding a work around.
Answer by calbar · Aug 19, 2013 at 07:28 PM
So my approach to drawing custom icons was made redundant by Unity 3.5 functionality.
Rather than create a custom icon script, turns out you can just choose a custom icon by selecting "Other..." in the Icon Selector, seen here:
Your answer
![](https://koobas.hobune.stream/wayback/20220613112343im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
How to solve the WebGL UnityEditor.WebGL.ProgressHelper.Show Error 1 Answer
Unity Editor - Create a custom scene view 0 Answers
Setting default quality level for WebGL Build not working 0 Answers
Build from script 3 Answers