Hello, i have a small problem with placing actors in the editor and getting a function called on them.
What i want is that when the actor is dragged out from the content browser and then placed in the world a function should be called to set some default values.
From what i have tested i can probably get the OnConstruction() function to do what i want.
I have the function set up like this.
void APhysicsActor::OnConstruction(const FTransform& Transform)
{
Super::OnConstruction(Transform);
if (!HasDoneFirstConstruct && GetWorld()->WorldType == EWorldType::Editor)
{
UE_LOG(LGeneral, Warning, TEXT("OnConstruction: %s, %s"), *GetName(), *Transform.ToString());
SetupDefaults();
HasDoneFirstConstruct = true;
}
}
What happens with this function is that the function is called twice, once when the actor is dragged into the editor viewport and then once more when the mouse is released and the actor is placed into the world.
Is there some way to fix so that it is only called once, when the actor is placed in the world?
Or is there some other way to achieve the results i want?
Thanks!