Reverse switch on int

Hi,

I am doing a scenario where I switch out the material of a mesh by pressing the right shoulder on a gamepad. Each press on right shoulder cycles through a switch on int. How do I reverse the loop when pressing the left shoulder on the gamepad so I can do a reversed cycle through material switching? Also, anyone know any good tutorials for UMG for gamepad?

If I was you, I’d put your n into a variable, replace the “Do N” with increase/decrease(left Shoulder button) logic and after that switch over it.

It would probably be better to simply have an int variable that you add to or subtract from and get rid of the Do N. This way you can more easily control what switch you’re on.

Right shoulder -> set int var += 1 -> switch
Left shoulder -> set int var -= 1 -> switch

edit: ninja’d

Ok, I think I understand how you are meaning but I have a har time getting it to work (new to blueprints and it´s been quite some time since I programmed). Does anyone have time to show me the node setup in a screenshot?


You are welcome.

The “Select Int” node ensures that the Int doesn’t exceed the range of [0,5]
This example works 0 inclusive to 5 inclusive.

You should put your Switch on Int into a separate function, so you don’t have duplication of the code.

Raildex_: Oh my god, that works! Thank you very much, I owe you beer!