Download

Get UPaperTileMapComponent MapWidth and MapHeight in C++

I recently dived in the c++ programming and want to know how to get the component’s MapWidth and MapHeight. The Paper2dTileMapComponent documentation points here as my guide. Below is the code snippet of the function I’m concerned with. Includes are already OK here btw . Its just how can I use this? Or there is an alternative? Will update the title if there is a better term for others to have an idea how to work on this

Thanks!

void UTileMapSetter::SetTileUN(UPaperTileMapComponent* TileMapComponentReference, UPaperTileSet* TileSet, FVector PivotLocation)
{ if (IsValid(TileMapComponentReference))
{
[INDENT=2]for (int32 y = 0; y < TileMapComponentReference->MapHeight; y++) //this part got an error[/INDENT]
[INDENT=2]{[/INDENT]
[INDENT=3]for (int32 x = 0; x < TileMapComponentReference->MapWidth; x++) //and also this part[/INDENT]
[INDENT=3]{

}[/INDENT]
[INDENT=2]}[/INDENT]
}

}

Update and the solution in case someone stumbles on this post. What the other devs answered on the other forums is this.
// declare the 3 variables

int32 Width;
int32 Height;
int32 Layers;
ComponentReference->GetMapSize(Width, Height, Layers);
for (int32 y = 0; y < Height; y++)
{ for (int32 x = 0; x < Width; x++)
{
[INDENT=2]// Do stuff[/INDENT]
}
}

The GetMapSize() is of void function so basically it won’t return any. Void function in the image from UE4.