Editor script to change prefab icon in project view

I use prefabs additionally as data containers. These containers should never be instantiated. To make it more clear, I would like to change icon for all of these prefabs which have a certain MonoBehavouir attached.

Is it possible to change the prefab project view icon based on attached components?

It’s outdated question. So I won’t go detail in this. Just some main idea.

You can find a SerializedProperty named “m_Icon” of GameObject’s SerializedObject. So you can modify it by script. Also there’s “m_Icon” on MonoImpoter for every script, so you can copy this property to your prefab’s gameobject.

Then you can hook into AssetPostprocessor to get this down automatically. Little bit tricky, but worth tring. Good luck.