Replacing "Storage" with Singleton Instance

Every time I used to want to acces a single-use gameobject (like GameController or CamerController) I would write a function in the Storage class that would do a "GameObject.Find()" function and return the object's script. This has been replaced with a Singleton ("public static scr_GameController Instance", for example) and assign the script as the Instance in the Awake() function. This Instance can then be called using scr_GameController.Instance… in place of Storage.GameController()… . Doesn't save in lines of code or characters, but hopefully the lack of a tag-based Find() will improve speed. Also it simplifies the lookup a bit.


Uitgelichte berichten
Binnenkort komen hier posts
Nog even geduld...
Recente berichten
Archief
Zoeken op tags
Er zijn nog geen tags.
Volg ons
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square