Spawn actor from const UClass*

Hello,

the struct FMovieScenePossessable returns me a const UClass*:

const UClass* GetPossessedObjectClass() const

Is the only way to spawn an actor from this class a const_cast? There is no version of GetWorld()->SpawnActor that takes a const UClass*. But NewObject<> does have one. Can I use NewObject<> instead and if yes, how can I use it so that I get the same result as with SpawnActor?

Thanks

One thing you can use - cast to remove const

const UClass* constPtr;
auto notConstPtr = const_cast(constPtr);
GetWorld()->SpawnActor(notConstPtr);

In common case, it is rather tricky to execute all the logic of SpawnActor with NewObject<> because of internal flags and scope parent links.