- Home /
Is there a better way to have custom Script icons than Assets/Gizmos
I know this was asked a lot of times probably .. but it is very often answered wrong.
What I want is:
Use a custom icon for specific components/scripts in the Inspector (e.g. Figure 2 and Figure 3) and the Assets window (e.g. Figure 1)
What I do so far:
For each component/script that shall have the icon I have an accroding Icon file in the folder
Assets/Gizmos/<Path>/<To>/<Namespace>/<ClassName> icon
This is working fine.
However, I wondered if there is really no better way having to have a unique Icon file for each script. This makes the project/UnityPacke unnecessary huge. Also if I rename a class I always have to rename the according icon file as well ...
Therefore my question:
Is there any better way to have those icons for scripts/components? Preferably scripted and reusing ONE single icon file instead of having the same icon in multiple differently named files.
!NOTE! What I definitely do NOT want:
Show the Icon also in the Editor view for all GameObjects having those components attached (e.g. Figure 4). This is caused by either selecting the icon for this script via the Inspector as in Figure 5 (as allways suggested e.g. in this post or here and even by Unity - Assign Icons ) or using OnDrawGizmos or DrawGizmo
have you taken a look at the meta file? I think its the place the icon is defined. with some scripting of that it might be possible
last screenshot. did you ever press the "other" button next to the icon color gizmos ;) ?
Yes I did .. but this is useless ;) .. I do not want that everyone using my imported scripts has to manually disable the Gizmos in the SceneView. ... Unfortunately Unity is using the word "Gizmo" a little unconsequently and until now I didn't even find any documentation how the thing with the Gizmos folder works ... I have it from this community ;)
have you taken a look at the meta file? I think its the place the icon is defined. with some scripting of that it might be possible
Hm yes I know that the icons are stored there ... but I'm not sure how I can change them by script ... Or do you mean I should change them all one by one?