Skip to content

Is it possible to instantiate child nodes without declaring extensions? #139

Answered by Splizard
pthm asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, I think the intent, is for, by including a path in the struct tag in your example (SpringArm/Camera), this should work as expected but the automatic children instantiation doesn't handle arbitrary paths yet, so it will use SpringArm/Camera if it already exists but otherwise I think currently it's being created directly as a child as you've observed. There's some nuances to sort out here, do we create plain nodes if there is no existing node for parents? ie. SpringArm/SomethingElse/Camera.

Note that there is another way to do this which is supported at the moment:

type ThirdPersonCameraController struct {
	Node3D.Extension[ThirdPersonCameraController] `gd:"ThirdPersonCameraController"`

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@pthm
Comment options

@pthm
Comment options

Answer selected by pthm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants