I’m currently working on a simple tool that allows me to pull out a spline whatever distance and generate tilemaps a certain height and width to match that spline. At the moment you can pull out the spline and then I generate the tilemaps as objects at runtime.
When I click on each individual component in this blueprint after they’re generated I’m allowed to edit said tilemap which is ideal as I’d like to edit individual tilemaps by hand for certain things. The problem is when I click on a tilemap to edit, it only ever lets me the first generated tilemap component that was created, nothing else.
As you can see, if I try to edit the tilemap to the left, it won’t let me, says I’m outside of the map of the first tilemap which is to the right. I dunno if this is a paper2d bug or I’m missing something in my implementation.
Any help is appreciated,
Thank you.
Edit: The main implementation of this little thing is done in c++:
void AProceduralTileMapGen::GenerateMap(FVector Relative_Location, int MapNum, FRotator SplineDirection)
{
FString Name = (TEXT("GeneratedMap_" + FString::FromInt(MapNum)));
FName MapName = *Name;
//Create a map component, provide it a generated name.
UPaperTileMapComponent* MapComp = NewObject<UPaperTileMapComponent>(this, TileMapSpawnClass, MapName);
if (!MapComp)
{
UE_LOG(LogTemp, Error, TEXT("Couldn't Create Map"));
return;
}
//Register the component and adjust it's width/height
MapComp->CreateNewTileMap(MapWidth, MapHeight, TileSizeSquare, TileSizeSquare);
MapComp->SetWorldLocation(Relative_Location);
MapComp->SetWorldRotation(SplineDirection);
MapComp->RegisterComponent();
FName InSocketName = NAME_None;
MapComp->AttachTo(MapLayoutSpline, InSocketName , EAttachLocation::KeepWorldPosition);
MapComp->bSelectable = true;
MapComp->bEditableWhenInherited = true;
MapComp->MakeTileMapEditable();
MapComp->RebuildCollision();
this->AddInstanceComponent(MapComp);
StoredTileMap.Add(MapComp);
FillTileMap(MapComp);
}
This is the code that the generator calls to create the tilemap component and then add it to the instance.