# Why do I get an error when I define a two-dimensional array?

**URL:** <https://forums.unrealengine.com/t/why-do-i-get-an-error-when-i-define-a-two-dimensional-array/2380387>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, UEFN, fortnite\
**Created:** [March 8, 2025, 4:57am UTC](https://forums.unrealengine.com/t/why-do-i-get-an-error-when-i-define-a-two-dimensional-array/2380387 "2025-03-08T04:57:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![renzymode](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@renzymode](https://forums.unrealengine.com/u/renzymode)\
**Post date:** [March 8, 2025, 4:57am UTC](https://forums.unrealengine.com/t/why-do-i-get-an-error-when-i-define-a-two-dimensional-array/2380387/1 "2025-03-08T04:57:19Z")

</div>

Why do I get an error when I define a two-dimensional array?

@editable  
CS1:creature\_spawner\_device = creature\_spawner\_device{}  
@editable  
CS2:creature\_spawner\_device = creature\_spawner\_device{}  
@editable  
CS3:creature\_spawner\_device = creature\_spawner\_device{}  
@editable  
CS4:creature\_spawner\_device = creature\_spawner\_device{}  
@editable  
CS5:creature\_spawner\_device = creature\_spawner\_device{}  
@editable  
CS6:creature\_spawner\_device = creature\_spawner\_device{}

CS:creature\_spawner\_device = array{  
array{CS1, CS2},  
array{CS3, CS4},  
array{CS5, CS6}  
}

For example, writing code like the above would result in an error statement such that the array could not be accessed. Why is this?

---

<div class="post-metadata">

**Author:** ![btwixer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@btwixer](https://forums.unrealengine.com/u/btwixer)\
**Post date:** [March 8, 2025, 5:45am UTC](https://forums.unrealengine.com/t/why-do-i-get-an-error-when-i-define-a-two-dimensional-array/2380387/2 "2025-03-08T05:45:08Z")

</div>

Pasting your code into one of my devices the error said it’s not implemented yet. Verse is still a fairly young language, and the @editable’s are coming from the 3D environment - so perhaps it’s just not supported in Verse at this time.

It looks like you can accomplish the same thing with the following - by moving the array setting into the OnBegin of the device.

```auto
my_device := class(creative_device):
    @editable
    CS1:creature_spawner_device = creature_spawner_device{}
    @editable
    CS2:creature_spawner_device = creature_spawner_device{}
    @editable
    CS3:creature_spawner_device = creature_spawner_device{}
    @editable
    CS4:creature_spawner_device = creature_spawner_device{}
    @editable
    CS5:creature_spawner_device = creature_spawner_device{}
    @editable
    CS6:creature_spawner_device = creature_spawner_device{}

    var CS:[][]creature_spawner_device = array{}

    OnBegin<override>()<suspends> : void =
        set CS = array{
            array{CS1, CS2},
            array{CS3, CS4},
            array{CS5, CS6}
            }

```

It compiles without errors anyway.

---

<div class="post-metadata">

**Author:** ![renzymode](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@renzymode](https://forums.unrealengine.com/u/renzymode)\
**Post date:** [March 10, 2025, 4:31am UTC](https://forums.unrealengine.com/t/why-do-i-get-an-error-when-i-define-a-two-dimensional-array/2380387/3 "2025-03-10T04:31:29Z")

</div>

Thank you!

Thanks to you I can now use two-dimensional arrays!

I am always helped by the wisdom of the people on this forum! I appreciate it very much!😄

---

<div class="post-metadata">

**Author:** ![btwixer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@btwixer](https://forums.unrealengine.com/u/btwixer)\
**Post date:** [March 10, 2025, 5:00am UTC](https://forums.unrealengine.com/t/why-do-i-get-an-error-when-i-define-a-two-dimensional-array/2380387/4 "2025-03-10T05:00:37Z")

</div>

You’re welcome, if you have a moment, it’s good to set the response that provides the solution as the “Solution” (there should be a button for that at the bottom of the response that solved it).

This let’s others know it’s solved, and it puts a link to the solution up top so it’s easy for others to find it who may be searching for a solution to the same problem.

---

<div class="post-metadata">

**Author:** ![renzymode](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@renzymode](https://forums.unrealengine.com/u/renzymode)\
**Post date:** [March 19, 2025, 12:30am UTC](https://forums.unrealengine.com/t/why-do-i-get-an-error-when-i-define-a-two-dimensional-array/2380387/5 "2025-03-19T00:30:28Z")

</div>

Thank you.  
I apologize for my very late reply.

I wanted to mark your response as the best answer, but I couldn’t find the “Best Answer” or “Solution” button on this page. I also couldn’t find the solution you mentioned.

Next time, I will make sure to check for those buttons so I can properly mark the best answer and help others in this forum.

This time, since I couldn’t find the button, I pressed the heart button instead.

Thank you again for your help!
