My end goal is to generate guids for actors once they are placed in the world.
Here is what I am attempting to do in my editor modules StartupModule()
onActorSpawnedDelegate = FOnActorSpawned::FDelegate::CreateRaw(this, &CT_EditorModule::OnNewActor);
GEditor->GetEditorWorldContext().World()->AddOnActorSpawnedHandler(onActorSpawnedDelegate);
The problem is that this
isn’t valid for the CreateRaw function. I am not sure if I am just working against the system here and there would be an easier way to do this, but any help would be appreciated.
I have also attempted to use:
FEditorDelegates::OnNewActorsDropped.AddRaw(this, &CT_EditorModule::OnNewActor);
However this only executes when an actor is dragged in from the content browser. I also need it to work for duplicating and right click > place actor.
I have also tried generating the guid in the actor itself on construction but I need the guid to be generated once and never change for that actor and the constructor is called frequently.