No announcement yet.

Looping through classes

  • Filter
  • Time
  • Show
Clear All
new posts

    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.

    Pretty complicated i think, not sure what you wanna do at all and there's probably an easier way to do that...

    Buuuut - to get back to your question - Loop Body is not connected, so it should never loop at all - or in a nutshell - do absolutely nothing during that loop. Normally you define what to loop in the array and the loop body decides what to do during each loop. Anyways, that's the only mistake i see in that small snippet. If you wanna debug that and see yourself then just connect a "printString" to that loop body and you'll see it firing.
    Last edited by Fronzelneekburm; 12-04-2017, 07:55 AM.
    My Patreon page (UE4 goodies!)