I have a plugin module where the implementation class is derived from custom derivation of IModuleInterface. The module loads fine and is accessible. Inside the module implementation I have a private regular C++ pointer (not decorated with UPROPERTY because after all this class is a module class and not an UObject) to a custom UObject. Inside StartupModule I allocate an instance of that object using NewObject<>.
Is this sufficient for keeping said private UObject alive? NewObject<> assigns a default Outer object, no? And so isn’t that good enough to keep it alive from the GC? I test the persistence by calling GetWorld()->ForceGarbageCollection(true) inside my custom PlayerController in the main game module repeatedly through a triggered UFUNCTION, and the UObject in question seems to stay accessible. I am just getting lucky or is what I am doing legit?