Trying to build a 2D array highlighted in bold below. It works fine if I use something like [5][6] to specify the dimensions but if I use variables, then I get this error: a nonstatic member reference must be relative to a specific object
I’ve attached the full code below, this is in the header file.
UCLASS()
class GAMEPROJECT7_API AMyActor : public AActor
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, Category = "Switch Variables")
int32 platformRows = 5;
UPROPERTY(VisibleAnywhere, Category = "Switch Variables")
int32 platformCols = 6;
public:
int getColSize(){
return platformCols;
}
int getRowSize(){
return platformRows;
}
**TSubclassOf<AActor> CubeClassTest[platformRows][platformCols];**
// Sets default values for this actor's properties
AMyActor();
// Called when the game starts or when spawned
virtual void BeginPlay() override;
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
};