All Questions

Community

uwi

The owner of PlayerState is StateMachine, not the Player?

I noticed that to set up auto-completion and type-checking, we created a new PlayerState which inherits from State. Here, we check if the owner is a Player class, however, based on the example, tree hierarchy shows the owner of the PlayerStates as the StateMachine?

This assumes that the parent will always be considered the owner on initialization. Is this not true?

  • Nathan Lovato replied

    The owner is the root of the scene a node is saved in; It's not the node's parent.

    So if you save the Player scene with all the state nodes directly in it, the owner of every state node will point to the root Player node.