From Unify Community Wiki
Revision as of 19:27, 19 October 2009 by NCarter
- Scripts which are derived from Monobehaviour can be terminated by destroying either the component or the game object which the component is attached to. After the object is destroyed the garbage collector is free to delete that script.
- Declarations define the elements of the script. Type declarations are used to define classes and enums.
- A declaration defines a name in the declaration space to which the declaration belongs. Except for overloaded members, it is a compile-time error to have two or more declarations that introduce members with the same name in a declaration space. It is never possible for a declaration space to contain different kinds of members with the same name. For example, a declaration space cannot contain a field and a method by the same name.
- There are different types of declaration spaces:
- -Each class creates a new a new declarations space. Names are introduced into this declaration space through class-member-declarations. A class permits the declaration of overloaded methods. Base classes do not contribute to the declaration space of a class, therefore a derived class is allowed to declare a member with the same name as an inherited member. This hides the inherited member.
- -Each enumeration declaration creates a new declaration space. Names are introduced into this declaration space through enum-member-declarations.
- -Methods create a new declaration space for local variables. Names are introduced into this space through local-variable-declarations.