I am currently working on a little side project, and to learn more about unreal’s replication system I decided to start adding it into my own little project. Within my project, I have a Game Instance that on Init(), creates an UObject class that I created (let’s call this class UWorldSingleton).
After it is created ( SingletonInstance = NewObject<UWorldSingleton>(); ), I pass on to it a reference to the current world, which I get from the GameInstance (ie. UWorld* CurrentWorld = GetWorld();, and then SingletonInstance->SetCurrentWorld(CurrentWorld);).
At the moment, my UWorldSingleton has a UPROPERTY() field UWorld* CurrentWorld; which is what I am setting the world to.
At the moment, nothing in my project has replication code. I only have skeleton data all over the place, and now that I am about to make the connection between my classes, I want to start adding replication. When starting a PIE with Clients = 2 (or more), I immediately crash at UEditorEngine::VerifyLoadMapWorldCleanup(), and get the error in line
UE_LOG(LogLoad, Fatal, TEXT("%s not cleaned up by garbage collection!") LINE_TERMINATOR TEXT("%s") , *World->GetFullName(), *ErrorString );
So I am currently wondering: for replication purposes, what is the right approach on creating world singletons through game instance, where I also have to manage UWorld pointers? Should I set replication authority on my UWorldSingleton, and replicate CurrentWorld to avoid this crash? Has anyone any good ideas/experience dealing with this?
Thanks in advance