FindByTag returns inactive entities

When I search by tag, deactivated entities are returned in the array of matching entities.

I verified this by inspecting the array and finding references to both an active entity with the tag present, and one for an (older) deactivated entity that I had kept around in case I needed it later.

This may be design, but I was expecting inactive entities to be ignored.

This is by design - imagine you might want to find an entity in order to enable it for example.

Understood. I guess I was used to the Unity workflow, where this isn’t the case.

Any chance of a variant that doesn’t (or a param that could be passed to ignore inactive)?

Appreciate the heads-up, thanks!

You could write the function yourself using the engine code:

So you could add a findByTagActive or patch the engine function to take a second parameter.

1 Like

Absolutely, yep. I’m just deciding whether to replace the original / create a differently named one / use a param.

Didn’t have the source link - thank you for that :slight_smile:

You should probably just make a method that only finds enabled entities, should be pretty simple :slight_smile:

Yep, that’s totally the plan, I didn’t want to get on that if it was considered a bug (and hence might change later), knowing it’s by design is all I need :slight_smile: