# Need help with an array/map

**URL:** <https://forums.unrealengine.com/t/need-help-with-an-array-map/487089>\
**Category:** Editor Scripting\
**Tags:** arrays, maps, unreal-engine, Array, Blueprint, question\
**Created:** [August 5, 2021, 10:22pm UTC](https://forums.unrealengine.com/t/need-help-with-an-array-map/487089 "2021-08-05T22:22:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wickie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Wickie](https://forums.unrealengine.com/u/Wickie)\
**Post date:** [August 5, 2021, 10:22pm UTC](https://forums.unrealengine.com/t/need-help-with-an-array-map/487089/1 "2021-08-05T22:22:35Z")

</div>

Alright so I have a grid system that works fine and until recently I did not notice it has a fundamental flaw that is not an issue until I have more than 500 rows in the X direction.

The issue is in this function below that creates the initial array.

I know it’s 100% in this part of the logic because I even loaded just this function and printed out the length of the map and it does not add up to how many should be in there.  
Example: if I have 100 Grid Size X and 100 Grid Size Y the length will be 10,000 as expected but when ever I have a Row X of higher than 500 it will not add up or maybe its rewriting the same index I am not sure but

If I set the Size of X and Y to 1000 each for example I should have a Map length of 1,000,000 but instead It gets a map length of 249,000.

I can’t seem to figure out what is causing this.

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/a/0/5a0a09e77bcce20cd6ce50c009a1e5f9f4e8bdab.png)

Now I know this isn’t exactly an array, but I did test it with an array instead of a map with the same logic and got the same result.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_929eef551](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_929eef551](https://forums.unrealengine.com/u/anonymous_user_929eef551)\
**Post date:** [August 6, 2021, 1:38am UTC](https://forums.unrealengine.com/t/need-help-with-an-array-map/487089/2 "2021-08-06T01:38:21Z")

</div>

You can try going into Project Settings and searching for ‘Maximum Loop Iteration Count’ and set it to a high number like 5000000. But I’m thinking you would get an error message if this was actually the reason.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 6, 2021, 5:49am UTC](https://forums.unrealengine.com/t/need-help-with-an-array-map/487089/3 "2021-08-06T05:49:19Z")

</div>

Either increase the loop count as suggested by @miyagi1 or, alternatively, do not generate it all in a single Tick…

Generate 10% wait .1s, generate next 10% and so on.

---

<div class="post-metadata">

**Author:** ![Wickie](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Wickie](https://forums.unrealengine.com/u/Wickie)\
**Post date:** [August 6, 2021, 6:51am UTC](https://forums.unrealengine.com/t/need-help-with-an-array-map/487089/4 "2021-08-06T06:51:29Z")

</div>

what would be the best way to do a loop in percentages? how would I interrupt the loop to load in chunks?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [August 6, 2021, 7:13am UTC](https://forums.unrealengine.com/t/need-help-with-an-array-map/487089/5 "2021-08-06T07:13:26Z")

</div>

You wouldn’t interrupt the loop. You’d run smaller loops several times. Pseudo-script:

 ![345737-screenshot-4.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/a/3/4a31490992129868d5c6c58ff0bfae0432947ad4.png)

Adding 1000 ints over a span of 1s (100 elements every .1s). This way you can have other world generating timers running on different intervals.

Were you to build an entire game world in one single _loooooop_, the application would freeze / crash; surely.
