|
@@ -30,7 +30,7 @@ Interacting with the active scene tree is **NOT** thread-safe. Make sure to use
|
|
|
# Unsafe:
|
|
|
node.add_child(child_node)
|
|
|
# Safe:
|
|
|
- node.call_deferred("add_child", child_node)
|
|
|
+ node.add_child.call_deferred(child_node)
|
|
|
|
|
|
However, creating scene chunks (nodes in tree arrangement) outside the active tree is fine. This way, parts of a scene can be built or instantiated in a thread, then added in the main thread:
|
|
|
|
|
@@ -39,7 +39,7 @@ However, creating scene chunks (nodes in tree arrangement) outside the active tr
|
|
|
var enemy_scene = load("res://enemy_scene.scn")
|
|
|
var enemy = enemy_scene.instantiate()
|
|
|
enemy.add_child(weapon) # Set a weapon.
|
|
|
- world.call_deferred("add_child", enemy)
|
|
|
+ world.add_child.call_deferred(enemy)
|
|
|
|
|
|
Still, this is only really useful if you have **one** thread loading data.
|
|
|
Attempting to load or create scene chunks from multiple threads may work, but you risk
|