SDKTypeBase interface

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

The SDKTypeBase interface is used as the base class for runtime object types in the SDK. An object type corresponds to an object listed in the Project Bar. Object types may have multiple instances.

SDKTypeBase cannot be directly constructed; it should only be used as a base class.

Properties

this._objectClass

Reference to the ObjectClass representing the object type that this instance belongs to.

this._runtime

Reference to the associated Runtime that controls execution of the project.

this._plugin

Reference to your addon's SDK plugin class, which derives from SDKPluginBase.

Methods

GetObjectClass()

Returns this._objectClass publicly.

GetRuntime()()

Returns this._runtime publicly.

GetPlugin()

Returns this._plugin publicly.

LoadTextures(renderer)

Optional override called by the runtime when it wants your object type's textures to be created. renderer is the same class used in the editor as IWebGLRenderer. This method should return a promise that resolves when all textures have been loaded.

ReleaseTextures()

Optional override called by the runtime when it wants your object type's textures to be released. This method is synchronous. Release any WebGL textures and drop the references to them.

OnDynamicTextureLoadComplete()

Optional override called by the runtime when a dynamic texture load has completed. If an object is created at runtime that does not already have its textures loaded, the runtime will call LoadTextures() but continue running the game while the textures are loaded asynchronously. When they finish loading, the runtime then calls this override so you have an opportunity to update any references to the newly loaded texture.