ObjectClass

Ashley's avatar
Medal
Construct Team Founder
Published 16 May, 2018
308 words
~1-2 mins

The ObjectClass class represents an object type or a family in the runtime. An object type is a kind of object that appears in the Project Bar, e.g. "Sprite2". Families are groups of object types. Generally object types and families can be treated the same. However in some cases you may need to treat them separately.

The runtime refers to something that is either an object type or a family as an "object class", hence the name ObjectClass.

Methods

GetSdkType()

Return the plugin-specific SDK type class, which derives from SDKTypeBase.

GetPlugin()

Return the plugin class for this object class, which derives from SDKPluginBase.

GetRuntime()

Return the Runtime for this object class.

GetName()

Return a string of the name of this object class.

IsGlobal()

Return a boolean indicating if this is a global object class. Global instances are not destroyed when changing layout.

IsWorldType()

Return a boolean indicating if the associated plugin is a "world" type.

GetBehaviorTypes()

Return a read-only array of BehaviorType representing behaviors added to this object class.

IsFamily()

Return a boolean indicating if this is an object type (if false) or family (if true).

GetFamilies()

For object types only. Return a read-only array of families (also ObjectClass) that this object type belongs to.

GetFamilyMembers()

For families only. Return a read-only array of object types (also ObjectClass) that are in this family.

GetInstances()

Return a read-only array of Instance that have been created.

GetSingleGlobalInstance()

For single-global plugins only. Returns the single-global instance of the object.

GetFirstPicked()

Return the first picked Instance in an action, condition or expression.

IsInContainer()

Return true if the object class is in a container.

GetContainer()

If the object class is in a container, return the Container class representing the container. Otherwise returns null.

HasSolidBehavior()

HasNoSaveBehavior()

HasPersistBehavior()

Convenience methods to indicate if the given behavior has been added to the object class.