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
- 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.
Scene graph methods
- Return the parent instance in the hierarchy, or
null if none.
- Return the top parent of this instance in the hierarchy (which by definition has no parent itself), or
null if none.
- A generator method that can be used to iterate all the instance's parents, up to the top parent.
- Return an array of all the children that have been added to this instance. The array may be empty if no children have been added.
- Generator methods that can be used to iterate all the instance's children. The
allChildren() variant is recursive, so will also iterate children-of-children.
- AddChild(childInst, opts)
- Add another instance as a child of this instance in the hierarchy. This instance becomes its parent. The child will move, scale and rotate with this instance according to the provided options specified in the object
opts, which supports the following properties:
Each option is a boolean which defaults to
transformX: move the child with this instance's X position
transformY: move the child with this instance's Y position
transformWidth: scale the child with this instance's width
transformHeight: scale the child with this instance's height
transformAngle: rotate the child with this instance's angle
transformZElevation: move the child with this instance's Z elevation
destroyWithParent: automatically destroy the child if this instance is destroyed
false if omitted, so only
true properties need to be specified.
- Remove an existing child that was previously added with
AddChild(). The child is detached from the hierarchy and this instance will no longer act as its parent. The removed child still keeps its own children, if it has any.
Addon SDK Manual
You are here:
Search this manual:
This manual entry was last updated on 9 Oct, 2020 at 14:01