Is the Branch node resource intensive to check type of player movement from a variable constantly?

Hi everyone, I am making a relatively small top down game that has to have both WASD movement and mouse click movement.

What is the best way to make an option in the settings panel to say that this user is currently using mouse click movement/WASD movement without constantly using a Branch node to check the variable isWASD?.

Is the Branch node in that case not resource intensive or is there a way to permanently say “hey this user likes to use mouse click movement so you just ignore WASD input and not even check the state of the variable isWASD?”.

Or is it best to split WASD and mouse click to two separate types of movement and on press of the wrong type you (from settings) just ignore it?

Thanks in advance!

If you run a function on Tick, it’s running every frame. Usually code like this and for loops run smoother when created in C++.

If you are creating a simple game, you shouldn’t have to worry about it. However a more optimized approach is to simply check what input was used the last time. You can create a variable called UsingMouse and if the player is using the mouse, set the variable to true, if the player is using W, A, S, or D, set it to false. Now you have a way to know what is used.

Please correct me if I misunderstood your question.

Edit: Alternatively you can simply have a setting in the main menu that forces a type of movement for the player, or have them select it on start, which can later be changed in the settings menu.

Yes that is what I needed. Thank you…

1 Like