0
Answered

compare multiple tags

William John Goodwater II 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 3
So Here is a question.

I got this On Collision Enter event, and i was wanting for it to check if the object is tagged as Cannonball or Explosive. now this view here is my most stable version that i could find. what i found interesting is if i try to call both compare tags at the same time i get a lot of bugs:
  • Sometimes my second one will register a Null on the bool output
  • Along with the first problem is when it did register a bool, if i had the bool split to 2 other nodes it would actually give one side true and another side false. (i some how Schrodingered my nodes.)
  • the Collider output of the On Collision Enter actually would only output to 1 of the compair tags.
  • and non of this would work any different if i made a second On Collision Enter.

Weird bug list aside i did get it to work with this setup, but on to my actual question, Is there a more efficient method of lining up multiple tag searches? Maybe a Enum Switch?

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
Answered

You can use Logic > Or unit with the output of both Compare Tags. Then, you would only need a single Branch.

oh my bad, i didn't enplane on that, i have two different events happening on Cannonball and Explosive. so I cant focus them into one branch. I was trying to build a Macro that would take 1 input along with whatever string of tags and then correlates them to different output flows.

Kinda like Logic > Comparison, but with flows instead of bools

You could use Switch On String then pass the tag as the input then!