I’m creating actors via command line in the editor through the EdEngine Exec. The actors I create go into the editor, not into the game realtime (I’m generating actors with components based on command line parameters). I’d like to be able to modify them in the level once they’re created as normal: modify parameters, location/rotation, copy/paste, have it be saved in the level and loaded like any other actor placed in the editor.
I’m using the basic:
NewActor = InWorld->SpawnActor<AActor>(AActor::StaticClass());
Then I add some components. For example:
UInstancedStaticMeshComponent *SMComp = NewObject<UInstancedStaticMeshComponent>(NewActor); SMComp->RegisterComponent();
and I call SetFlags(RF_Transactional); on the actor and the components.
Problem #1: I can’t modify any properties on the components in the editor. It says native components need uproperties. There is no C++ class for this. I simply spawn an empty actor into the level and add components on the fly.
Problem #2: If I spawn my actor with a name (using FActorSpawnParams), and then I try to spawn another actor with the same name, instead of increasing the counter on the name like it normally happens in editor, it doesn’t spawn anything and SpawnActor returns the actor that already has that name. I’d like to give it an arbitrary name that automatically counts up when I try to place more of them.
Problem #3: If I add two Instanced Static Mesh Components to one actor, the second one shows up in PIE but not Standalone. If I set RF_Standalone on the component, they’ll show up in Standalone mode, but not in the packaged build, and playing it in PIE hits an ‘ensure’.
Problem #4: Copying/Duplicating the actor, doesn’t Copy/Duplicate the Instances array in the InstancedStaticMeshComponent. This problem also happens if I create the actor and components directly in the editor, so it’s not a C++ problem. I’d like to be able to copy and/or duplicate these actors though.
Problem #5: Can’t move the actor from one sublevel to another because of Problem #4 (apparently Unreal copies, deletes, and pastes to make that happen). When I say move, I mean assign the actor to a different level, I don’t mean change the location. Like, select the actor, click on the level editor, select the level you’d like to move the actor to, right-click it and select “Move Selector Actor to Level”.
Is anyone familiar with spawning an actor for in-editor use? Any ideas?