I have multiple enemies that all have a sub-scene detection.tscn on them. This is an Area2D with a CircleSphere. I am setting the radius of the CircleSphere for each enemy individually through code.
However this is where the problem is. When I load the scene, the radius is the same for all enemies (it's always equal to the radius of the enemy that is the lowest in the scene hierarchy). I have deduced the problem to be that the detection.tscn is shared by all the enemies. If I enable EditableChildren on detection.tscn then the problem disappears (the radius is different for each enemy). The instances are separate in this case (which is what I want).
But ideally I want them to be separate without having to enable EditableChildren. If I recall correctly then this behavior (that the scenes all share one instance) is actually the wanted (default) behavior. I also think that there is an easy fix for my issue, I just don't remember what exactly it was.
Usually, it's enough to set "local to scene" to the resource (CollisionShape is a resource) to be able to change it separately. It's normal behavior for resources in Godot.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With