Forum rules - please read before posting.

Load Game overstacks

Hi there,
I got a strange behaviour and I  cannot understand why.
I'm in a scene where I added a few objects based on some variables, I save the game and then I continue playing.
Let's say that after a few minutes I'm back to the same scene but this time with different objects around. I don't like something so I'm gonna have to load from the previous save, which I did in the same scene. Now I have both the objects which where there when I saved the game and the objects I had before loading.

Does any of you know what could be an easy fix for this?

Comments

  • Details will be necessary to properly help.

    AC and Unity version numbers, please.  Let's also see screenshots of the objects in question - namely their Inspectors and the Actions you're using to add them.  If they're prefabs, lets see those as well.

    Are these multiple instances of the same prefab, or are all objects linked to separate prefabs?

    Typically you use the "Remember Transform" component with Save scene presence? checked.  The object's prefab must then be given a unique name and placed in a Resources folder - see the Manual's "Saving asset references" chapter.
  • Unity : 2017.3.1f1
    AC: 1.60.4

    I won't add the images here because it will be hard to read, but I'll give you the links 
    So here is the OnStart Action that I call when I start/load a scene
    https://i.imgur.com/TRmHUhY.jpg
    In action I check what is my GameStatus (GSE1) and if it's a certain one  to load a certain prefab.
    In the example I will show you I'll stick to GSE1 - 2 and GSE1 - 5
    In GSE1 - 2 I should load this prefab
    https://i.imgur.com/7G6v4yk.png
    While in GSE1 - 5 I should load the default prefab which is made by this two objects
    https://i.imgur.com/8MvbqGs.png
    https://i.imgur.com/1fysAl8.png

    Now in the GamePlay I went to kitchen Scene and it was GSE1 - 2 so the first prefab loaded, like you see in the photo below:
    https://i.imgur.com/KcKrizO.png
    I do I save here and then continue playing.
    After I played the game I managed to reach GSE1 - 5 and then I went on kitchen and it seemed that I should load the default prefabs and it worked like in the photo below
    https://i.imgur.com/uEhPX4g.png
    Now being still in the scene I decided I need to go back to the previous save so I load the game from that point and when the load was one I was in GSE1 - 2, but I had both the prefabs from the GSE1 - 5 ( what I had before loading) and the prefabs from the GSE1 - 2 (what I should have), you can see in the picture below
    https://i.imgur.com/yeeOLTO.png

    I hope you can understand and help,
    Thank you!
  • edited November 2018
    I don't know your reasons for it, but personally I'd lay out each prefab next to one another within the scene itself and then just cut to a different camera to show each view.

    The issue is that you aren't instructing AC that the state of the objects you're adding to be stored within save games.  When you load the game, it doesn't know that "DEFAULT" should be removed.

    A prefab's state in the scene is normally recorded via the Remember Transform component.

    That "GS_2-4" correctly appears must be because the Actions in your OnStart are also called from your OnLoad, I'm assuming.  Therefore, it's probably easist to just use the Object: Add or remove Action at the start of this list to remove any instances of all these prefabs from the scene before adding the correct ones.
  • Thanks for the idea. I think the camera switch could work just fine. Thanks.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.