Static: everything used by a static function needs to also be static.
(still not super clear on what can and cannot be static, research reading later)
Crazy hackery to refer to an otherwise non-static class:
Protected static |class| |instance name| = null;
void Awake() {
|instance name| = this;
}
Notes:
protected = just means "members of flowerScript can see this, everyone else go away"
static = "this variable is shared by every member of this class, and you don't need to be a member to use it"
flowerScript = this is the type of our variable
m_instance = the name I picked out
"type" is like int, string, etc.
Any class you make is a type too.
null = I don't have an initial value for this, so I'm leaving it empty for now
Singleton: a clean way for static objects to be able to accept and use editor links.
No comments:
Post a Comment