#Is there a way to ensure a scene will have nodes of specific types instantiated on it?

2 messages · Page 1 of 1 (latest)

golden horizon
#

Say I want to create a class, Entity, and that class has a script that will take in a 4x4 sprite sheet and render it based on the entity's computed movement direction and movement speed.

I want to extend this to all of my entities - monsters, the player, etc. The desire is that, to create a new entity, all I'd have to do is make a new scene with the entity as the root node, and give it some Sprite2D.

My question, though kind of silly, is: is there a way to enforce this relationship? I.E, an Entity must have a Sprite2D? It seems there are some Godot nodes that throw a warning (i.e, an Area2D needs a CollisionShape2D), and I'm wondering how I could leverage that for my own purposes.

somber trench
#

https://forum.godotengine.org/t/how-to-create-custom-editor-warnings-in-a-tool-script/37573
I think you're looking for this? unfortunately referencing a forum post but I can't find any documentation for get_configuration_warnings