SDKWorldInstanceBase interface

Ashley's avatar
Medal
Construct Team Founder
Published 15 May, 2018
186 words
<1 min

The SDKWorldInstanceBase interface is used as the base class for runtime instances for "world" type plugins. It derives from SDKInstanceBase.

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

Note instances that create a DOM element should derive from SDKDOMInstanceBase instead.

Properties

this._worldInfo

Return the WorldInfo object that represents this instance's state in the "world" (e.g. its size, position, angle etc). In the runtime this is held as a separate object.

Methods

GetWorldInfo()

Returns this._worldInfo publicly.

HandleWebGLContextLoss()

Utility method to enable calling of the OnWebGLContextLost() and OnWebGLContextRestored() methods.

OnWebGLContextLost()

OnWebGLContextRestored()

Optional overrides for handling WebGL context loss. This is only necessary if your addon creates any WebGL resources. These overrides are only called if your instance first calls HandleWebGLContextLoss() (normally in the constructor to enable these callbacks for the lifetime of the instance). In a context loss event, all WebGL resources have been released, so any references to them must be dropped. In a context restored event the resources may be recreated again if necessary. Alternatively they can be left released if a lazy-loading approach is used.