9#include "Engine/World.h"
11#include "Kismet/GameplayStatics.h"
12#include "TimerManager.h"
16 StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT(
"StaticMeshComponent"));
18 PrimaryActorTick.bCanEverTick =
false;
19 InteractableName = NSLOCTEXT(
"Agrarsense",
"StaticInstancedActorInteractableName",
"Prop");
39 Super::EndPlay(EndPlayReason);
41 if (EndPlayReason != EEndPlayReason::Type::EndPlayInEditor)
79 UE_LOG(LogTemp, Warning, TEXT(
"InstancedActor.cpp: Already added to instanced rendering."));
87 UE_LOG(LogTemp, Warning, TEXT(
"InstancedActor.cpp: %s Actor is not being renderered by UInstancedStaticMeshComponent. If you did not mean to do this, make sure AddToInstancedRenderer is set to true in blueprint."), *this->GetName());;
135 if (InstanceRenderer)
152 if (InstanceRenderer)
165 FString Path = Mesh->GetPathName();
166 if (Path.Contains(
"Tree"))
void UpdateTransformPosition()
bool AddToInstancedRenderer
void InstanceAdded(int32 CompIndex, int32 InstanceNum)
void UpdateIndex(int32 UpdatedIndex)
UStaticMeshComponent * StaticMeshComponent
FTransform PreviousTransform
AInstancedActor(const FObjectInitializer &ObjectInitializer)
void SetUpdateTransformAutomatically(bool UpdateAutomatically)
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override
bool AddedToInstancedRenderer
bool ShouldUpdateTransformAutomatically
void RemoveFromInstancedRendering(bool EnableStaticMeshComponent=true)
virtual void BeginPlay() override
bool AddToInstancedRendering()
bool AddActorToInstancedRendering(AInstancedActor *InstancedActor)
void RemoveInstance(int32 ComponentIndex, int32 InstanceNumber)
void UpdateInstanceTransform(int32 ComponentIndex, int32 InstanceNumber, const FTransform &NewTransform)
void AddOrRemoveActorFromAutomaticTransformUpdates(bool Add, AInstancedActor *InstancedActor)
static AInstancedRenderer * GetInstancedRenderer(const UObject *WorldContextObject)