Hi,
I would need to retrieve a pointer to my world (what you usually get with… GetWorld()) from within my save class, derived from USaveGame.
However, any attempt at retrieving something related to the world always returns a null pointer.
Is there a way to get a reference to the world from within USaveGame?
Any help is greatly appreciated!
Thanks,
f
Have the object that calls for a SaveGame call a ‘setter’ in USaveGame that caches a pointer reference to the world?
So for example, if your GameMode object creates a new USaveGame, then maybe you can do something like MyNewlyCreatedSaveGame->SetWorldRef(GetWorld());
Something along those lines I would imagine might work.
(I’m assuming you are extending USaveGame with your own custom class - if not you probably should)
Thanks CodingRook,
that’s indeed the solution I’ve implemented shortly after posting my question, and yes, it works! More precisely, I’m passing a world pointer to the functions that needs it, e.g.
void UMySaveGame::SaveGame(UMySaveGame* progressToSave, UWorld* referenceToUWorld)
cheers
f