How to cycle through array with wrap begin and end - blueprint beginner tutorial

Just a little code snippet. This is one of those things I struggled with a lot early when learning programming with blueprints :

If you find yourself struggling with stuff like this, I suggest don’t try to read descriptions. Just copy/paste and then use debug watch values as you push inputs in the game and watch how things change. You’ll be able to understand what is happening much easier that way.

*note that convert enum to string to text is not a proper way to set UI text for a real game in which you’d need translations and such. It’s just for getting things setup quickly.

1 Like

Not a fan of modulo?

1 Like

I can’t math :slight_smile:

actually I have used modulo before for something else. But how would you use it here?

Not that it makes for less or clearer script. It just comes across as a natural way to wrap things around for me. Usage demoed here. Not entirely sure if it fits.


I’d probably stick with what is transparent.

1 Like

I have to setup the blueprint first then watch the number. I never remember exactly what it does, just that it returns remainder or something like that, and certain patterns can indicate if it’s even, odd, etc.

But I’ll plug that code in and give it a shot - it is much fewer nodes so should make for tidier work. Thanks!