Best Practice: Refencing Nodes inside sub-scenes

Godot Version

4.3

Question

:wave: hi folks.

I have a scene (a car) with another scene (car cosmetics) inside of it.
In the editor I’ve right clicked the sub scene and checked “make editable children”; So I’m able to drag nodes into the parent scene’s script to get a reference.

ex:
@onready var right_back_wheel: MeshInstance3D = $"CarMesh/wheel-back-right"

Now that I’m trying to make the car less prototype & more game ready, I want to be able to swap out the car cosmetics scene as needed.

What’s the best way to expose sub-scene elements to the parent script if it’s not “editable” or “local”?

  • @export vars may help but such references are usually @onready … that hurts my brain.
  • I thought perhaps unique names, but it doesn’t look like that would work.
  • I suppose I could write functions to expose everything I want to do, but… ugh.
  • Groups feel messy.

Looking for best practices… :person_shrugging:

THANKS!

You can still access the sub-scene nodes through scripts without “editable children” enabled.

You are correct, Unique names only work for the current scene

1 Like

:exploding_head: :expressionless: :no_mouth: :roll_eyes:
Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.