• 15 Posts
  • 119 Comments
Joined 2 years ago
cake
Cake day: July 14th, 2023

help-circle














  • Yes, as long as you know what components are inside the Zombie scene, then you can export it. But the idea of being more flexible is that you shouldn’t need to update the Zombie class when you add a new component to it. E.g. You want the zombie to be “Bumpable” now (for some reason :)), then you should be able to just add the Bumpable node to your Zombie scene and that’s it. With your approach, you’d need to also reference and export it in the Zombie class first.





  • Correct, I’d also use exported values if possible. But that isn’t flexible enough in some cases, because you’d need to individually export all possible attributes that the node might have.

    For it to be more flexible, you could have something like this:

    for child in get_children():
      if child is ClassNameHere:
        return child
    

    That would give you the same result as described in the article, without string reference. You could make a static func for it and call it a day :)