Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

GameManager.cs Icon ?

Discussion in 'General Discussion' started by BlackMantis, Jul 9, 2018.

Thread Status:
Not open for further replies.
  1. BlackMantis

    BlackMantis

    Joined:
    Feb 7, 2010
    Posts:
    1,475
    First time in a long time I named an script GameManager, and to my surprise Unity gave it a gear icon.
    Icon.png
    Mind = Blown, lol
    Super cool, what others are there if any ?
     
    Aresboss, Strogman and chelnok like this.
  2. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,462
    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.

    Gizmo.png

    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.

    ScriptExample.png

    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.

    SceneExample.png
     
    Last edited: Jul 9, 2018
    Magnilum, chelnok, instasiv and 11 others like this.
  3. BlackMantis

    BlackMantis

    Joined:
    Feb 7, 2010
    Posts:
    1,475
    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.
     
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,625
    Kiwasi likes this.
  5. diegomendes

    diegomendes

    Joined:
    Sep 20, 2014
    Posts:
    29
    It's not fixed, is happening on 2018.1 o_O.
     
    CrandellWS and ascavalcante80 like this.
  6. pabitrapadhy

    pabitrapadhy

    Joined:
    Feb 4, 2017
    Posts:
    6
    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.
     
  7. dpoly

    dpoly

    Joined:
    Nov 10, 2016
    Posts:
    35
    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.
     
  8. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    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.
     
    instasiv, Nodrap, Ryiah and 3 others like this.
  9. Epicsninja

    Epicsninja

    Joined:
    Aug 31, 2018
    Posts:
    2
    So is there any reason to NOT call a script GameManager?
     
    chzwhz likes this.
  10. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Not really. It looks a little funny in the inspector. That is all.
     
    instasiv and tamassengel like this.
  11. hard_code

    hard_code

    Joined:
    Aug 29, 2013
    Posts:
    238
    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" :D
     
  12. FMark92

    FMark92

    Joined:
    May 18, 2017
    Posts:
    1,243
    If script doesn't manage the game, I wouldn't call it that.
     
  13. nishantro

    nishantro

    Joined:
    Jun 16, 2019
    Posts:
    1
    i think it looks cool
     
    Quevanto, pandolfini and A_Savvidis like this.
  14. fmontserrat

    fmontserrat

    Joined:
    May 24, 2015
    Posts:
    4
    also naming a script "folder" puts a folder icon on it. Wich is a bit anoying.
     
  15. Rodolfo-Rubens

    Rodolfo-Rubens

    Joined:
    Nov 17, 2012
    Posts:
    1,197
    Hahaha, I didn't know this one, time to prank my coworkers.
     
Thread Status:
Not open for further replies.