First time in a long time I named an script GameManager, and to my surprise Unity gave it a gear icon.
Mind = Blown, lol
Super cool, what others are there if any ?
I don’t know about default icons but you can manually assign icons to scripts using one of two methods.
For the first method you simply create a root folder named “Gizmos” and add an image (PNG file format) with the name of the script followed by a space and the word “Icon”. Unity will automatically assign that image to that script as an icon and it will show up in the Project View and the Inspector.
For the second method you simply click on the script and then click on the icon at the top of the Inspector and you will be given a small menu with a number of colors available. Simply click “Other” and it will open up a window showing all of the Texture2D assets in your project. Click the one you want and it will be assigned to it.
Furthermore the second method can be done to GameObjects in your scene. Once you’ve assigned an icon to a GameObject and deselect it it will show as the gizmo in the Scene View.
Since GameManager was a key word that triggered the icon, are there any special features belonging to it ? ( eg ) In the same way that key name folders like Materials, or Resources.
It’s a bug that should be fixed since Unity 2017.2 actually:
What Unity version do you use?
It’s not fixed, is happening on 2018.1 .
If you could relate then, it’s sort of like keywords in programming language.
They are reserved, if you want to create something with exact name, using namespace will help you in that case.
It’s not a bug, scripts with those names are present in Unity, so the icon assignment module, assigns icon to anything with the same name.
USE NAMESPACE, clear all your confusions.
This is baked into Unity, but it’s a fake problem. It arises only when you put your user-written code into the global namespace. Don’t do it!
The real answer is that all user-written script code should be in its own namespace – that’s what the feature is there to do. It would help if the Unity templates adopted that convention.
Even calling it a fake problem is a little harsh. Its a cosmetic problem. It doesn’t have any effect on how your game runs.
Its nothing to do with putting stuff in a name space, that’s a completely separate discussion.
So is there any reason to NOT call a script GameManager?
Not really. It looks a little funny in the inspector. That is all.
When I first started using Unity and noticed the icon for my GameManager.cs script I thought to myself “Sweet I must be doing something right cause that file has a special icon”
If script doesn’t manage the game, I wouldn’t call it that.
i think it looks cool
also naming a script “folder” puts a folder icon on it. Wich is a bit anoying.
Hahaha, I didn’t know this one, time to prank my coworkers.