10 #include "Components/InstancedStaticMeshComponent.h" 11 #include "Engine/StaticMesh.h" 14 const FObjectInitializer& ObjectInitializer) :
15 Super(ObjectInitializer)
17 PrimaryActorTick.bCanEverTick =
false;
19 ObjectInitializer.CreateDefaultSubobject<USceneComponent>(
this, TEXT(
"SceneComponent"));
20 RootComponent->SetMobility(EComponentMobility::Static);
25 auto Instantiator = NewObject<UInstancedStaticMeshComponent>(
this);
26 check(Instantiator !=
nullptr);
27 Instantiator->SetMobility(EComponentMobility::Static);
28 Instantiator->SetupAttachment(RootComponent);
29 Instantiator->SetStaticMesh(Mesh);
30 Instantiator->RegisterComponent();
51 if (Instantiator !=
nullptr) {
52 Instantiator->ClearInstances();
AStaticMeshCollection(const FObjectInitializer &ObjectInitializer)
TArray< UInstancedStaticMeshComponent * > MeshInstantiators
void ClearInstantiators()
Clear the instances too.
void PushBackInstantiator(UStaticMesh *Mesh)
uint32 GetNumberOfInstantiators() const
void SetStaticMesh(uint32 i, UStaticMesh *Mesh)
void AddInstance(uint32 i, const FTransform &Transform)
geom::Transform Transform