# ForLoop not working

**URL:** <https://forums.unrealengine.com/t/forloop-not-working/389808>\
**Category:** Audio\
**Tags:** macro, macros, unreal-engine, loop, UE4, Blueprint, question\
**Created:** [April 3, 2017, 10:08am UTC](https://forums.unrealengine.com/t/forloop-not-working/389808 "2017-04-03T10:08:29Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_ca0743c9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ca0743c9](https://forums.unrealengine.com/u/anonymous_user_ca0743c9)\
**Post date:** [April 3, 2017, 10:08am UTC](https://forums.unrealengine.com/t/forloop-not-working/389808/1 "2017-04-03T10:08:29Z")

</div>

I am using a forloop that has its index connected to a macro I made. The macro then links to a print string.  
When I run the level, all the prints are based on the last index of the forloop alone. The first index and so on don’t seem to be effecting the output of the macro  
Anything I’m doing wrong?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a2ba6052](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a2ba6052](https://forums.unrealengine.com/u/anonymous_user_a2ba6052)\
**Post date:** [April 3, 2017, 10:22am UTC](https://forums.unrealengine.com/t/forloop-not-working/389808/2 "2017-04-03T10:22:54Z")

</div>

Provide a snapshot of your blueprint, for loop part and macro.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ca0743c9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ca0743c9](https://forums.unrealengine.com/u/anonymous_user_ca0743c9)\
**Post date:** [April 3, 2017, 10:57am UTC](https://forums.unrealengine.com/t/forloop-not-working/389808/3 "2017-04-03T10:57:28Z")

</div>

Here it is:

 ![132636-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/2/c/d2c8712732bea7805c38241af73bd3550bf3fb8e.png)

The index is connected to fixture number and is passed as an argument in an html request.

---

<div class="post-metadata">

**Author:** ![MrGoatsy](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mrgoatsy/32/918697_2.png) [@MrGoatsy](https://forums.unrealengine.com/u/MrGoatsy)\
**Post date:** [April 3, 2017, 11:47am UTC](https://forums.unrealengine.com/t/forloop-not-working/389808/4 "2017-04-03T11:47:21Z")

</div>

I think the issue is with the `JSONFixtures` because when I try to use a for loop it works fine.

[http://i.imgur.com/J4YzE4C.png](http://i.imgur.com/J4YzE4C.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ca0743c9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ca0743c9](https://forums.unrealengine.com/u/anonymous_user_ca0743c9)\
**Post date:** [April 3, 2017, 12:39pm UTC](https://forums.unrealengine.com/t/forloop-not-working/389808/5 "2017-04-03T12:39:52Z")

</div>

Well, I don’t exactly think so because if I link another JsonFixture and Print String after the orginal two without any loop, they both respond according to their indices as intended.

---

<div class="post-metadata">

**Author:** ![MrGoatsy](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mrgoatsy/32/918697_2.png) [@MrGoatsy](https://forums.unrealengine.com/u/MrGoatsy)\
**Post date:** [April 3, 2017, 2:23pm UTC](https://forums.unrealengine.com/t/forloop-not-working/389808/6 "2017-04-03T14:23:59Z")

</div>

Can do do a print string after the loop body and before the `JSONFixtures`?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ca0743c9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ca0743c9](https://forums.unrealengine.com/u/anonymous_user_ca0743c9)\
**Post date:** [April 3, 2017, 2:41pm UTC](https://forums.unrealengine.com/t/forloop-not-working/389808/7 "2017-04-03T14:41:11Z")

</div>

I don’t see the point of that because I print the data that is output from JSONFixtures.

---

<div class="post-metadata">

**Author:** ![MrGoatsy](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mrgoatsy/32/918697_2.png) [@MrGoatsy](https://forums.unrealengine.com/u/MrGoatsy)\
**Post date:** [April 3, 2017, 3:33pm UTC](https://forums.unrealengine.com/t/forloop-not-working/389808/8 "2017-04-03T15:33:20Z")

</div>

Just do it to test out whether the for loop is working or not.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ca0743c9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ca0743c9](https://forums.unrealengine.com/u/anonymous_user_ca0743c9)\
**Post date:** [April 3, 2017, 4:21pm UTC](https://forums.unrealengine.com/t/forloop-not-working/389808/9 "2017-04-03T16:21:39Z")

</div>

Ya, the ForLoop works fine without the macro

---

<div class="post-metadata">

**Author:** ![MrGoatsy](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mrgoatsy/32/918697_2.png) [@MrGoatsy](https://forums.unrealengine.com/u/MrGoatsy)\
**Post date:** [April 3, 2017, 4:23pm UTC](https://forums.unrealengine.com/t/forloop-not-working/389808/10 "2017-04-03T16:23:41Z")

</div>

Please double click the macro and show us that.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ca0743c9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ca0743c9](https://forums.unrealengine.com/u/anonymous_user_ca0743c9)\
**Post date:** [April 3, 2017, 4:45pm UTC](https://forums.unrealengine.com/t/forloop-not-working/389808/11 "2017-04-03T16:45:10Z")

</div>

It uses nodes from the Varest plugin.

 ![132652-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/3/df3740fde8f1936cbe4d497459b6274cd5bd6b03.png)

 ![132653-capture1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/7/2/b72146f702aed40cbc0d82b020b8990ff924dde0.png)

sorry for the mess. I’m beginning to think it’s because of the download image node which is a delay of sorts

---

<div class="post-metadata">

**Author:** ![MrGoatsy](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mrgoatsy/32/918697_2.png) [@MrGoatsy](https://forums.unrealengine.com/u/MrGoatsy)\
**Post date:** [April 3, 2017, 5:04pm UTC](https://forums.unrealengine.com/t/forloop-not-working/389808/12 "2017-04-03T17:04:25Z")

</div>

Please put a unique print string after each executable node to see where it stops working.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ca0743c9](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ca0743c9](https://forums.unrealengine.com/u/anonymous_user_ca0743c9)\
**Post date:** [April 4, 2017, 9:12am UTC](https://forums.unrealengine.com/t/forloop-not-working/389808/13 "2017-04-04T09:12:40Z")

</div>

Its okay, got it to work how I wanted by following this link:

> **[How do I add a delay to each iteration of a foreachloop?](https://forums.unrealengine.com/questions/50642/question-how-do-i-add-a-delay-to-each-iteration-of.html)**
>
> You should make the loop manually, create a Variable of type int called “myindex” with default value of 0, Use a GET node on your array, and plug myarray in “Index”, Set visibility for the result of the GET node, Add 1 to myindex. Use a Branch node...

Thanks for the help tho!
