it brings me straight to the return node of the ExistsToDestroy function
Accessed none trying to read property SaveREF
it brings me straight to the return node of the ExistsToDestroy function
Accessed none trying to read property SaveREF
Yes, but it happens as soon as the game starts? When you click on load? When a barrel is destroyed?
it just popped up as I pressed play, I didn’t give me the chance to destroy any barrels, also the barrels disappear as the game starts like its destroying all of them
Ok, thats good. Can you share a picture of what you have in Init event in game instance?
Could you please show what is inside the GameLoad function?
It seems the save game object isn’t properly initialized or referenced in the GameInstance. Since Init() is called before any BeginPlay, the object should be created or loaded there to avoid null reference errors.
Don’t modify the function, remove it from Init and do this instead:
This is just to get it working without any access none errors. We can worry about matching the string to the corect slot latter.
it worked theirs no more errors
I still get the issue where the barrels disappear, if I disconnect the event begin play of the bp_barrel they show up again
Edit: I added a is valid before the destroy actor it helped but the barrels wont save
Leave everything as it was. Close the editor, delete the save files and try again.
Sad to say it didn’t solve it, there are no errors though probably not being saved or not being loaded properly
They are being saved. The issue is that the string in the Init event is probably not the same as the one assigned on the save menu.
I suggest either force the game to load the slot 1 on start or bypass the save / load menu for now.
First get it working, then integrate everything else.
honestly, I don’t know where to even start and this is draining me, like I’m so close to finishing the save system but it’s confusing since I just started it. I appreciate your help so far though
Is there a way for me to finish it now with your help instead of bypassing stuff I don’t want to put this on hold when I’m so close to finishing it.
Display the menu at start of the game so save game can be instantiated with the correct slot during new game or load. Also remove what was added in Init event.
Level needs to be loaded after load so barrels can check save game during begin play. I’m sure there will still be other things to solve before getting it to work properly.
It won’t be a “now” solution. The save game object should not live in the pawn; menus and systems should access it through the game Instance.
After a quick Discord session, this is how we got it working:
The GameInstance
instantiates a default SaveGame
object at startup. This instance remains alive throughout the game, preventing any Access None
errors. The save menu simply uses this existing SaveGame
object to write to the assigned slot when saving or loading, keeping all save logic centralized in the GameInstance
.
To handle persistent actor destruction, we moved the logic into a custom ActorComponent
. Now, any actor that needs this behavior just adds the component. On OnDestroy()
, the component adds the unique ID to the SaveGame
. Then, on BeginPlay()
, it checks if that ID is marked for destruction and, if so, automatically destroys the actor.