xyz I'm trying to export some variable in a child node, and to do so, I've declared an exported variable inside the root node. Using setter and getter methods I'm updating the child node. But the update does not reflect inside the editor.
I have used @tool to make it update in the editor too. But the variable in the root node is local to instances, and the child node (CollisionShape3D) is a shared resource. Updating the value in an instance inspector does change the child for all instances, but the numbers inside the inspectors remain different.
Using Engine.is_editor_hint inside _process function, I've managed to update the numbers as well, however if I change the number in an instance in another scene and save the project and exit, the values set in the main scene itself will overwrite the values set in the instances. Because I haven't navigated to the main scene before exiting and the _process (and _ready) has not been called.
I'm new to Godot... so sorry if there is any stupidity in my workflow xD
But here are the codes:
@tool
extends Area3D
@export var size = Vector3.ONE:
get:
return size
set(value):
size = value
if not is_inside_tree():
await ready
get_node("CollisionShape3D").shape.size = size
func _ready():
if Engine.is_editor_hint():
if size != get_node("CollisionShape3D").shape.size:
size = get_node("CollisionShape3D").shape.size
print("ready")
func _process(_delta):
if Engine.is_editor_hint():
if size != get_node("CollisionShape3D").shape.size:
size = get_node("CollisionShape3D").shape.size
print("process")