# How do I make a 2D array of AActors in c++?

**URL:** <https://forums.unrealengine.com/t/how-do-i-make-a-2d-array-of-aactors-in-c/456427>\
**Category:** Asset Creation\
**Tags:** tarray, aactor, tarray:-arrays-in-un, unreal-engine, CPP, question\
**Created:** [October 4, 2019, 4:56pm UTC](https://forums.unrealengine.com/t/how-do-i-make-a-2d-array-of-aactors-in-c/456427 "2019-10-04T16:56:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JustMikeMB](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JustMikeMB](https://forums.unrealengine.com/u/JustMikeMB)\
**Post date:** [October 4, 2019, 4:56pm UTC](https://forums.unrealengine.com/t/how-do-i-make-a-2d-array-of-aactors-in-c/456427/1 "2019-10-04T16:56:13Z")

</div>

I originally had a TArray of TArrays of a class, making a 2D array of classes, this worked out until I wanted to add collision to each of the nodes in the 2D array. To resolve it I tried to change the empty c++ class into an actor and change all the references into pointer. The problem now is that im getting the error:

```
nonstandard extension used: class rvalue used as lvalue

```

What I’ve figured out so far is that im getting a temporary address and unreal doesn’t accept that.  
If there is another way of creating a 2D array of actors or even better, a more reliable way of giving collision to all the nodes in a 2D array mainly to check if the player is in one of the individual nodes I would very much appreciate some guidance.

Thank you in advance

---

<div class="post-metadata">

**Author:** ![MajinSephiroth](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MajinSephiroth](https://forums.unrealengine.com/u/MajinSephiroth)\
**Post date:** [October 4, 2019, 8:01pm UTC](https://forums.unrealengine.com/t/how-do-i-make-a-2d-array-of-aactors-in-c/456427/2 "2019-10-04T20:01:39Z")

</div>

You can create a multidimensional array using structures.

```
USTRUCT()
struct FMultiActorStruct
{
	GENERATED_USTRUCT_BODY();

	//Structure members
	TArray<AActor*> MyActors;

	//Constructor initializing members
	FMultiActorStruct()
	{
		MyActors.Empty();
	}
};

```

Then just declare the array in your class and you’re good to go

```
//Array declaration in class
TArray<FMultiActorStruct> MultiActorArray;
```
