From Unify Community Wiki
Revision as of 20:08, 26 August 2013 by Caue.rego (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Why a new page? Couldn't you just have updated (and possibly renamed) the old AManagerClass page?--KeliHlodversson 05:58, 12 February 2009 (PST)

This isn't a singleton.

This isn't a singleton. It just provides a global access point to a particular instance. You can create several instances of the class. See for details.

"In computer engineering, the singleton pattern is a design pattern used to implement the mathematical concept of a singleton, by restricting the instantiation of a class to one object"

Well, the class constructor should be private. That way only the class itself could create another instance. Of course, component based manager are quite useful but you can't prevent that the user create more than one instance. What you can do is to destroy any additional instances in Awake() --Bunny83 04:06, 12 April 2011 (PDT)

Clean up

So... I'm thinking in cleaning up this article. It is a big mess right now.

It should be a simple and effective singleton implementation which would cover all the current topics. Agree?

Also, in my mind, a Unity Singleton should be a Component, MonoBehaviour and "dontdestroyonload", all by definition. I see no sense in making any other kind of singleton.

Finally, from my experience, there is a very (and only one) good reason to use Singletons. We need global vars. The other way to do them is `static`. But that can easily get out of control and break things up. Again, from experience. There. "Simple" as that.

I just haven't cleaned it yet because: (A) I haven't created this topic. (B) I'm by no means a deep knowledge expert on this whole subject and I found nothing to back me up.

So, any thoughts?

--Caue.rego (talk) 18:25, 26 August 2013 (CEST)

Well, there. Cleaned. Thanks to Dustin Horn, Angry Ant, my oriental work colleague, Herman Tulleken and many others. And sorry if I made any grotesque mistake there...

--Caue.rego (talk) 21:39, 26 August 2013 (CEST)

Personal tools