I created a scipt and editor for it. Now I want to assosiate an icon with it like this:
How to do such thing? Cant find any documentation on this.
I created a scipt and editor for it. Now I want to assosiate an icon with it like this:
How to do such thing? Cant find any documentation on this.
You can change the icon by selecting the Object in Project view. Then click the icon in the upper left corner in the Inspector. Then select Other
.
[Picture Guide] So after you have selected the script, click on the icon marked in red in the picture below:
Look at the picture below for guidance.
If you want to assign an icon to a custom script, I believe you can create a gizmo icon for it and place the image at a project location that maps to the namespace of your script. My understanding is for each MonoBehaviour in your assembly, Unity looks for an associated icon with the name "<className> Icon" under the "Gizmos" folder, but the hierarchy must match the namespace.
So if your MonoBehavior is TestClass
and its namespace is Company.Project.Foo
, you would place the image in your project at "Assets/Gizmos/Company/Project/Foo/" and image name should be "TestClass Icon".
Your script will then have the icon associated with it when viewed in the Inspector, but I don't believe this will cause it to appear in the SceneView. You should use the DrawGizmo
attribute on an editor script, if you want to make the icon appear in the SceneView or perform any other custom gizmo drawing.
In the following example screenshots, I have a script called SafeArea
with the namespace Greyborn.Library
. I placed the "SafeArea Icon.png" at "Assets/Gizmos/Greyborn/Library/", and the icon immediately appeared in the Inspector and Project windows.
I used a PNG. Other image types may be supported, however when I tested with a PSD image, the gizmo wouldn't show up. Be sure to set the Texture Type to "Editor GUI and Legacy GUI".