Field Summary |
|
protected static final Simulator |
sim The simulator handle to access the Play Mode's API. sim is null when executed from Editor mode. |
Constructor Summary |
Script() Constructor |
Method Summary |
|
ResourcePath |
getResourcePathForId(String resourceId) Gets a resource path for an id |
void |
onExit() Will be called right before the Script instance is stopped. |
bool |
onInit() Will be called after the Script instance was started. |
bool |
onLateInit() Will be called after onInit was called for all scripts. |
void |
onLateUpdate() Will be called right before each frame is rendered and after onNextFrame was called for all scripts. |
void |
onNextFrame(float tick) Will be called between two consecutive rendered frames. |
void |
run() main entry point. Will be called by the engine, must not be called manually. |
Field Detail |
Constructor Detail |
protected Script()
Constructor
Method Detail |
public final ResourcePath getResourcePathForId(String resourceId)
Gets a resource path for an id
The resourceId is typically specified in the script setup or description.
Parameters:
resourceId | - | The resource id that was specified in the script setup or description. |
Returns:
ResourcePath that represents the path to the file, will return null if the resourceId is unknown
Since:
2.5.7.0
public void onExit()
Will be called right before the Script instance is stopped.
Overload to deintialize resources.
public bool onInit()
Will be called after the Script instance was started.
Overload to intialize resources.
Returns:
Return true to indicate success. Returning false will stop initialization and aborts execution.
public bool onLateInit()
Will be called after onInit was called for all scripts.
Overloading this method might be usefull for initialization code that needs to run after all onInit calls. There is no guarantee in which order the onInit method gets called for each script. Using onLateInit might solve the problem of unordered initialization code.
Returns:
Return true to indicate success. Returning false will stop initialization and aborts execution.
Since:
2.5.7.8
public void onLateUpdate()
Will be called right before each frame is rendered and after onNextFrame was called for all scripts.
Overloading this method might be usefull for scripts that show objects or HUDs attached to the viewer. Other scripts might update those objects and with using onNextFrame all alone, it is not possible to guarantee that a specific script gets invoked after another. Using onLateUpdate will solve that problem.
Since:
2.5.7.4
public void onNextFrame(float tick)
Will be called between two consecutive rendered frames.
In case of low framerates, this call might get called multiple times until a frame gets rendered.
Parameters:
tick | - | is the delta time in seconds, that happened since the last call to onNextFrame. It usually is the time between two consecutive rendered frames. |
public final void run()
main entry point. Will be called by the engine, must not be called manually.