I’m trying to figure out the best way to cycle through an array one item at a time. So basically any time a certain event is called, it gets the next item in my array. I’ve tried using a For Each loop, but since it’s a loop, goes through the entire index, instead of incrementing by one.
the easyest way i would suggest to use is simply creating a variable that is storing the index of the array you want to use next. So this variable should start with the value of 0 and should be increased (by 1) every time your function finishes.
Use the “get from array by index” function to get the member of the array
As ** said… you just create an integer variable in your blueprint to hold the current index. You get the object form the array using that integer, do the things with it, and then determine your next index value. There are two possible cases with the next index value:
If the current index is the last index in the array => reset the index to zero
If the current index is not the last index in the array => increment the index
In this example, the variable is saved locally. Just access it from the variable panel. Similar to the “Increment Index” area in the example where there is ‘GET’ and ‘SET’ usage to increment the variable.
Hello everyone,
I am currently trying to rebuild this blueprint and I hope this thread (as old as it is) is not dead. I want to achieve the following: I want to create a blueprint which I can place in the editor, then “fill” it with several static meshes (by using the details panel). Ingame it should then show the static mesh in slot 01 and the static mesh should switch to the next slot when I press a button on my controller.
As far as I understand I can do this by “filling” an array with my static meshes and then use the integer variable to define which “slot” is currently shown but apparently I am missing some steps because i Can not “create” the “GET” and “LENGTH” nodes shown in the solution.
Would it be possible to give a little bit more background for a complete newbie in blueprints?
thx a million
jajujo
EDIT: I have to create the “Setstatic mesh” Function (here represented as the “Do things” node in the middle… am I right? Oh i am quite confused - sry