BP Cycle through meshes on input

I would do a if integer = bigger than end mesh index number then set to 0
It’s probably a good idea to use a integer to index the meshes for this purpose. That’s how I did it in my game anyway every time I pressed right i + the integer by 1 and every time I went left i minus it. I think I used a select with the integer as the index then plug in the meshes for reference. Might be a easier way for the way your doing it like get last item in array or something i dont know kuz im quite new at this

Basically all you need is make a integer variable. Get a select plug the integer in the select index node. Get references to your meshes. Plug them into the select node thing top to bottom. Get the integer variable you made again and +1 it then from f set the integer and plug the output of the + into the set. So every time u press f it adds 1 to your integer and after you set integer put your set static mesh down and the output of the select into it. Then get your integer again and do a if > or = to a higher number than your last item. Then set your integer again this time set it as 0 and it should cycle back.
I’ve never used the set mesh node so hope it works

I have been working on a BP to cycle through static meshes in a scene with a keyboard input. So far I can get the items to cycle. However I can’t figure out how to send that cycle back to the beginning once all the options have been cycled through. Can anyone help me please?

Thanks, I am not really too sure how to do that. Could you recommend a good place to learn about that method?

I have set up the integer to cycle through numbers but I still cant figure out:

  1. How to loop the integer

  2. How to connect the meshes to each integer

Thanks for the help so far

I will wire summin up myself and post a screenshot for u to copy gimme a minute.

where it says new var 0, new var 1 and so on. I dragged of the select and promoted to variable as to set the meshes to the variables without them spawning. I made a static mesh in the blueprint with nothing attached to it so it works like an empty slot for the meshes to spawn as new var 0 will be the first mesh anyway.

Hopefully this does it.

I would probably change the >= for a > and set the number to a 2 in this case.

Yea just change the >= for a > and set the number to the last index in the select remembering to include a 0 as the first one because it always confuses me

It definantly works I just checked it. You could also put the top part of the code off of event begin play to the construction script tab just so it does that before it even loads up.

If you want to make sure theres no null errors you can use a is valid node before everything aswell. and if its invalid set index to 0 although I don’t think this is much of a problem in blueprints

If you need me to break any of it down more then just ask.

Got it working thanks to your help! Thank you so much, I have learned a lot from it. I have it working. The only issue I am having now is connecting the variables to the select. However I can select the meshes straight from the selector so that isn’t really much of an issue.

Yea i noticed having the meshes already set and trying to connect them doesn’t work but if you drag of select and promote to variable you can set the mesh inside the variable and it will work. Just need to make sure the variable is set to static mesh compile it then select the mesh inside the variable.