Ashley's avatar
Construct Team Founder
Published 16 May, 2018
487 words
~2-3 mins

The Instance class represents an object instance in the runtime.



For "world" type plugins, get the instance's associated WorldInfo. This allows modification of the position, size, angle etc.


Get the Runtime for this instance.


Get the plugin-specific instance class for this instance, which derives from SDKInstanceBase. See also Addon interfaces for the public APIs exposed by some of the built-in addons in Construct.


Get the ObjectClass representing the object type this instance belongs to.


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


Returns true if this instance's object class is the given object class, or the given object class is a family and this instance's object class is a member of that family.


Get an image point from the instance by either its index or a string of its name. Note image points are returned in a [0,1] range, such that 0.5 represents the middle.


Returns true if the instance is in a container.


Return a read-only array of sibling instances for this instance, i.e. its associated other instances in its container. This is only applicable if the instance is in a container.


Get the unique identifier (UID) for this instance. UIDs are unique integer numbers assigned to every instance, and never change during the lifetime of the instance.


Get the instance identifier (IID) for this instance. IIDs are the zero-based index of this instance in its object type's instance list. Note IIDs can change during the lifetime of the instance; if an instance with a lower IID is destroyed, all instances with higher IIDs are renumbered so the IIDs are contiguous from 0.


Return a read-only array of BehaviorInstance for this instance.


Look up a behavior instance by its behavior constructor. For example GetBehaviorInstanceFromCtor(C3.Behaviors.Platform) will return the first BehaviorInstance for the Platform behavior if the instance has one, else null.


As with GetBehaviorInstanceFromCtor(ctor), but returns the behavior-specific behavior instance class (which derives from SDKBehaviorInstanceBase) instead.


Return the number of instance variables for this instance.

SetInstanceVariableValue(index, value)


Set or get an instance variable value by its index. Note the type of the instance variable will be preserved.



Return a Map to store additional data to associate with this instance. Use string keys only, and ensure keys are unique. The saved data map is written to savegame files so should be used for persistent state. The unsaved data map is not written to savegame files so should be used for transient storage or caching.