I have a single custom actor in simple world (single level) which I want to consist of “tiles” for the ground. For now, the ground is just made of 4 “Plane” static meshes that I’ve manually placed (see image). I’ve added these static “Plane” meshes by dragging them from the “Place Actors” view in the editor, positioned and scaled them. These planes are completely sufficient for my needs, but I want to know how to add them dynamically through C++ as the actor approaches the “edge”.
I’ve seen a few code snippets which are something like some combination of the following:
static ConstructorHelpers::FObjectFinder <UStaticMesh>StaticMesh(...); static ConstructorHelpers::FObjectFinder<UMaterial> Material(...); SomeType *Plane0 = GetWorld()->SpawnActor<SomeType>(SomeThing, SpawnLocation, SpawnRotation);
I’m not quite sure how to piece this together. For example, how to get a “built-in” “Plane”, how to get a “built-in” material. Should my actor be the one to be “placing” these? Should the actor keep the pointers to them? Can I remove them from the world if necessary? Things like this I’d like clarification on.
I wanted to ask with my full context to see if I’m even going down the right path for this.