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

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

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;
1 Like