I have a GameBoard class which contains the variable board, a TArray of Tile pointers. A single Tile displays the mesh correctly but when I try to render multiple tiles via one board instance nothing is rendered . Here is an example of one way that I have tried
-
Tile Constructor
Mesh = CreateDefaultSubobject(TEXT(“Mesh”));
Mesh->SetStaticMesh(LoadObject(nullptr, TILE_MESH_PATH.GetCharArray().GetData())); -
GameBoard BeginPlay()
for (int row = 0; row < DIMENSIONS; ++row) { for (int col = 0; col < DIMENSIONS; ++col) { ATile* tile = NewObject<ATile>(); FVector offset = FVector(row * TILE_WIDTH, col * TILE_HEIGHT, 0.0f); tile->SetActorLocation(this->GetActorLocation() + offset); board.Push(tile); } }
-
In the editor drag a Board (which has a scene node component) into the scene and hit play
I am reasonably comfortable with how to use C++ but trying to transition to Unreal