How to remove a tag from an actor in flax engine via C#?

How to remove a tag from an actor in flax engine via C#?

Some sudo code for you.

For removing a tag I would do something like this for now:

Tag tagToRemove;
var tags = new List<Tag>(Actor.Tags);
tags.Remove(tagToRemove);
Actor.Tags = tags.ToArray();

The important part is you have to set the Actor.Tags = new tag array

Hope this helps. Like with everything in coding there are many ways to achieve the same result.

I also added a remove tag method in a PR to the engine. If approved you should be able to just do Actor.RemoveTag(). https://github.com/FlaxEngine/FlaxEngine/pull/1357

3 Likes