What's the proper way to keep ‌consistency‌ of variables?

Good for that purpose, but things like 2D Shape size is unable to bind to a resource.

What do you mean by 2d-shape size? Resources have a changed-signal which you can connect to update your code

1 Like

Not that good if you made TargetDetector depends on Fighter class’s definition. For gdscript it’s logically duck typing (C# can do so with interface), and TargetDetector can fetch from any class with Range field, but it still need the root to be a node that has Range field.

Fighter has a child node TargetDetector; TargetDetector inherits Area2D.
Area2D owns a CollisionShape2D; CollisionShape2D owns a CircleShape2D; CircleShape2D has a field Radius, indicates its size.

So I make a resource RangeRecord, it is referenced by Fighter. And then? Don’t know what’s next to do to keep CircleShape2D.Radius= RangeRecord.Range…

well here you are trying to synchronize two resources. either make your resource inherit circle-shape2d (or use the shape directly if you dont need other properties) and have all your objects reference this resource or you need to write a logical layer in between