Table of Contents
Godot Engine (Actions)
The information is relevant for version 2.9.42.100 and later.
Description of Godot Engine module's Actions.
Godot Action
Allows you to pass commands and parameters to the running Godot scene. This Action calls the action_received
signal in the SLService node.
Parameters
- Param1 - random name of the command to be processed on the scene script side.
- Param2-Param10 - parameters sent to the scene.
Command Sending Scheme
The image shows an example of interaction between software modules when sending commands to the scene.
Adding Handler
- Add the SLService node to the project.
- Add a handler function to the action_received signal.
- Describe the commands in the handler function body.
Parameter Passing Example
In the scene script, the command and parameters are received via the action_received (name: String, params: PackedStringArray) signal:
func _on_sl_service_action_received(name, params): print("action received"); if name == "Label" : $Label.set_text(params[0]);
Load Scene
Loads a scene from a pre-loaded Resource Pack to Godot Engine. Multiple scenes from one or more Resource Packs can be loaded simultaneously. Scenes loaded later are rendered later (closer to the viewer). If you use any output layer overrides, such as z-buffer or z-index for 2D, the output will look different from the simple output order.
Parameters
- Param1 - name of the scene to load.
- Param2 - optional parameter. The list of parameters passed to the scene to be loaded. A Dictionary object (associative array) with the passed key-value pairs will be created on the scene side. The field value can look like element@value, where
element
is the name of the key in the array andvalue
is the value to be substituted. If over one key-value needs to be transferred, they must be separated with @. For example: param1@val1@param2@val2.
Unload Scene
Unloads a pre-loaded scene from Godot Engine.
Parameters
* Param1 - name of the pre-loaded scene.
Load Resource Pack
Loads Resource Pack from a *.zip or *.pck file. The file must be located in the directory specified in the Project Path setting. Multiple Resource Packs can be loaded simultaneously.
Parameters
* Param1 - Resource Pack name with file extension (e.g., test.zip).
Unload Resource Pack
Unloads Resource Pack from Godot Engine. The scene pre-loaded from the Resource Pack will continue to function until unloaded, unless it loads new files from that Resource Pack.
Parameters
* Param1 - name of the pre-loaded Resource Pack (must match the name used when loading).