I need to know how I can keep an object from respawning once I load my save for example like an item. And also, how to keep an object in the last position, I left it like a door or switch.
(post deleted by author)
Each actor should have a unique ID. In your SaveGame, store a list of IDs for actors that should be destroyed on the next load (like picked-up items). On BeginPlay, each actor checks if its ID is in that list—if it is, it destroys itself.
For persistent objects like doors or switches, store their unique ID along with their current state (e.g., open/closed, on/off) in the SaveGame. When the game loads, each actor reads its own data and applies the correct state.
I personally prefer this approach over using Get All Actors of Class. Letting each actor fetch its own data keeps things more modular and easier to manage.
I see, I’ve been having a hard time implementing this since I’m new to game saves is it possible for you to walk me through this? I already have a save-game blueprint, and a game instance with game-save and game-load functions in it.
Could you take a look at this and tell me what I might’ve done wrong. I think I did what you told me, but the ADDUNIQUE is giving back errors and when I destroy a barrel, like barrel_1 barrel_2 gets destroyed also when I load the save
Rather than an array, try and use a set container.
Could be that they have the same id. The container variable in save game should be empty by default since each actor will add its id when triggered.
Also, create functions in game instance to add and get from. Only use game instance as an interface and avoid communicating directly to save game. The barrel does not need (and should not have) a ref to the save game object.
Ok so the UniqueID var i made should be empty got it and also they dont have the same ID because i called one barrel1 and barrel2. i’m also confused on how to implement the functions your talking about, is there a screenshot you could show me?
Yes, the UniqueID set container in game save game should be empty by default. Each actor has to have an id assigned.
Here is a quick example. These are the function for Game Instance
The actor to destoy would look something like this:
This would be triggered on overlap or after some other trigger.
So, I tried copying your code, but I still get the errors I assume it can’t read anything in the save game ref or is it something else entirely ?
Remember to not do this:
Use the function from game instance.
In BP_GameInstance, how are you creating or loading the save game object?
I should’ve stated I got this save system from a YouTube tutorial, but it does seem that the load game is being created in a function in the game instance the function is called game load
Where is this function being called?
Apparently, its being called in the begin play of my player character it’s the only place its being called
Try and call it in Init event in game instance for now, not in the pawn.
Let me know if you get same error.
What are you referring to when you say Init I’m not familiar with all the terminologies, and also it does seem the game load is being run in the event graph of the game instance sorry about that.
In the game instance event graph, right click and search for Init event.
Enable this and let me know what happens right before the game stops: