I have Save/Load functionality where I use LoadGameFromSlot
, SaveGameToSlot
and SaveGame
object. When I use it inside the UE4 editor - everything works fine. But when I make a package and launch it as a separate game - it doesn’t work.
For example I save game on Level_1
, then open Level_2
and load saved game. After load is finished - player teleports outside of the map. I checked - values of all variables including player location was saved and then it was loaded correctly.
I can’t understand, what is wrong. I tried to make different packages but the error is still there.
Here you can see values of the variables when I press Load button after level was loaded for both versions - which I launch from UE4 and from the package. It is the same
So now I removed all load logic and only try to place player to zero location, but it still don’t work.
It sounds a bit like you don’t have a player, or they are spawning at 0,0,0.
Could it be that your character is missing, or your game mode isn’t working?
I have tried this and in returned ‘Cast Success’
Are you sure the Node (different from before changes) SetActorRelativeLocation instead of World?
Relative Space is based on Actor’s Root, so 0,0,0 is exactly where you placed your Pawn, and it will have totally different Value in World Space
You mean I should do this? I tried it and it still dont’ work in the packaged game. But it work inside game engine. Maybe I should change some package settings
I just meant the node you used
Before you changed it was Set WORLD Location, after you changed you used Set RELATIVE Location
You don’t have to use Root Components
I just clarified the difference between WORLD and RELATIVE Space
Relative = Relative to Parent (Root of the ACTOR)
World = Relative to World Coordinates
When you move Player to 0,0,0 then in World it’s in the Center of the World, in Relative it’s center of Actor, if you place it in World on 100, 3500, 0 then Relative Location CAN still be 0,0,0
On the other hand you can have Relative Location of 100, 3500, 0 and World will be something totally different
Hi. I have added code with ‘!’ comment and it works. I only added delay 2 seconds. And I have checked that GetPlayerCharacter retutn value. It is very strange. I don’t want to leave it like this because maybe on slow computers it will require more than 2 seconds delay. But still don’t understand why is this happening.
I can reproduce it (without my change with delay) when I load save game from another level. If I load current opened level - it works.
What does
when I load save game from another level
mean?
Also I see some lil unclarities there:
Why don’t you handle SaveGame the indended way? What if SaveGame DOESN’T exist? You totally skip creation of a new save game in case you changed Slot Name?
Some stuff if you don’t need to save but have from start till end of game - game instance is better
And that it needs 2s delay - yes, you’re right, on slower machines it may take longer
When you click Play then there’s some sort of organization about what runs first, what last
So maybe moving your SaveGame Handling methods somewhere else?