Download

It's wrong for a switch node to run all the time with the Tick event?

hi, i’m making a game where the character has multiple abilities, like mario 64 or crash bandicoot 3, what i have done is create an enum with all the states (walk, jump, swim, climb, hit, etc) and then i created a switch node that executes these abilities according to the enum, the node switch executes all the time with the tick event, is this ok this way ?, or that the switch node executes all the time is bad for performance

I don’t know, the best is to make your own test. Because it would depend of your hardware and your tolerance in optimisations xD

The switch in question is just checking an enum so it’s fine. Generally you want to avoid doing things on Tick, but sometimes it can’t be avoided. If it can be part of an event or be done on a timer it’s much better than using it on tick.

Switches on string are terrible for tick, though. You just need to think about how long it takes to resolve something to a boolean - checking a byte against a byte (enum) is super quick while checking an array of bytes against another array of bytes (as in a string) is exponentially more expensive.