Download

Looping through classes

Hey all, having a bit of trouble, I’m new to unreal engine and I’m trying to create a button that cycles one by one through objects. I thought I should mention this is for mobile and its AR.

I’ve created a widget class with a few button.
I’ve called an event dispatch when the cycle through button is pressed or clicked (first image)

Ive put most of my functionality in the level blueprint. (image 2)

It adds the widget to the viewport.
I then created a NewEventDispatcher_0_Event - this triggers every time the cycle through button in the widget is pressed so that’s a start. It’s communicating.
I now want this button to cycle through the actors I have in the Select node (testobject0-9). these are then spawned when the screen is touched.

I created a bunch of integer variables (0,1,2,3), I thought if I put these in an array and then used a forEachLoop node I’d be able to pass this through to the index of the select node which would keep selecting the next testobject in my list

Whats weird is it cycles through 2 objects and then stops. Odd.

Anyway I’m sure it’s because I haven’t set up something right. If anyone can see anything I’d really appreciate the help. I’m going around in circles.