Godot Version
4.3
Question
I have created a “Road sign” scene that is:
node3d – attached script – “road sign”
-
- MeshInstance3d – box mesh – “sign body”
-
-
-
- Label3d #1 – “sign_label_front”
-
-
-
-
-
- Label3d #2 – “sign_label_back”
-
-
-
- MeshInstance3d – box mesh – “pole”
The script has an update_label() function (pasted below) that:
- updates the text of the labels, and
- resizes the box mesh based on the size of the label text.
This script is triggered by checking an “Update” box in the inspector.
This works.
But, when I reload my scene, the label text and boxmesh have reverted back to the road_sign scene’s default value.
Is there a way I can make these changes to the text labels and the sign body size permanent besides
- Setting each road_sign in my scene as having editable children
or - Running the update_label() function in each road_sign’s _onready()
?
If not, what are the downsides of making 20+ objects have editable children?
## Triggered by checking the "update" box in the inspector
func update_label():
var Label_Front : Label3D = $sign_body/sign_label_front
Label_Front.text = sign_text.capitalize()
$sign_body/sign_label_back.text = sign_text.capitalize()
var sign_mesh : BoxMesh = $sign_body.mesh
sign_mesh.size.x = Label_Front.get_aabb().size.x