Does anyone know how to spawn a box from code. As i just simply want to spawn boxes and make them move down a path for now.
This is my code which doesn’t do what I want.
AMyActor::AMyActor()
{
RootComponent = OurVisibleComponent;
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
Box = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Box"));
static ConstructorHelpers::FObjectFinder<UStaticMesh> MyBox(TEXT("StaticMesh' / Game / StarterContent / Shapes / Shape_Cube'"));
UStaticMesh * test = MyBox.Object;
Box->SetStaticMesh(test);
Box->AttachTo(OurVisibleComponent);
}