Instance creation API
Queue adding a source instance or cloning an existing entity.
When to call it
Call for bounded gameplay events such as spawning a projectile, enemy, pickup, or effect. Avoid unbounded per-frame creation.
Calls
instance.add(source, parent?)instance.clone(source, parent?)
Variables
| Variable | Type | Required | Description |
|---|---|---|---|
source | string | Yes | Source asset or stable scene path. |
parent | string or null | No | Destination parent stable entity ID; omit for the default root. |
Return and timing
No new entity ID. Creation is queued and applies after the callback in issue order.
Language examples
Lua 5.4
lua
instance.add('Game.scene.Prefabs.Crate', nil)
instance.clone('Game.scene.Enemy',Game.scene.Find('Game.scene.Room'))JavaScript
javascript
instance.add('Game.scene.Prefabs.Crate');
instance.clone('Game.scene.Enemy',Game.scene.Find('Game.scene.Room'));Python
python
instance.add('Game.scene.Prefabs.Crate',None)
instance.clone('Game.scene.Enemy',Game.scene.Find('Game.scene.Room'))C++
cpp
instance.add("Game.scene.Prefabs.Crate",std::nullopt);C#
csharp
instance.add("Game.scene.Prefabs.Crate",null);Luau
lua
instance.add('Part',nil)
instance.clone('Room.Enemy',Game.scene.Find('Room'))C
c
instance.add("Part",NULL);
instance.clone("Room.Enemy",Game.scene.Find("Room"));Java
java
instance.add("Part",null);
instance.clone("Room.Enemy",Game.scene.Find("Room"));PHP
php
$instance->add("Part",null);
$instance->clone("Room.Enemy",$Game->scene->Find("Room"));HTML / inline JS
javascript
instance.add('Game.scene.Prefabs.Crate');Constraints and behavior
- Every gameplay language calls the engine-owned API. Rustic supplies SDKs and dispatches callbacks; scripts do not parse requests or serialize responses. See the language guide for complete setup and callback registration.