Forum rules - please read before posting.

Equipment window

124»

Comments

  • What are your AC/Unity versions now?

    If you're looking to save the checkbox state of a Sprite Renderer, Remember Visibility is the right component to use. The alternative would be controlling things through animation, and using a Remember Animator.

    To be clear: this is on a child object of your Player? Is this Player spawned in via the Settings Manager, or are they part of the scene file?

    If the former, does placing the Player in the scene file cause it to work? That won't be the solution - just a means of narrowing down the source of the problem.

    Please share screenshots showing the object's Inspector, as well as the ActionList used to affect it. After creating a save-game file with the problem, open up the Save-game file Manager at the top of the Settings Manager and bring up the raw data list for it.

    Look for the "Player data" section, that should list all the save data related to the Player. Towards the bottom, there should be a "Remember data" section. If that is present, share a screenshot of it.

  • Hello again,
    Just updating to tell you that the save system works perfectly for some scenes, and not others.
    The Player is a prefab that is spawned into all of my scenes, but if I do place it manually into the scenes where it previously didn't work, now it does.
    However, there's no difference as I can tell in how the Player character is spawned into the scenes.

    When I check the save game in the editor, I can clearly see a list of Object Visibility data saved whenever the system works, but not when it doesn't.

    Just to reiterate how it works:
    1. If I equip an item, it moves from my inventory to a container. Simultaneously, I turn on the visibility of child object of the Player game object.
    2. If I unequip an item, it's the reversed process, only I have to script it manually. This all works fine.

    In some rooms, when I equip an item and save, when I load again the item will have disappeared from the container, even though it's still visible as a game object.

    I'll begin uploading screenshots if you don't get any immediate ideas based on the above...

  • Not an idea as such, but if the issue is that the Container is missing an item - rather than the object being incorrectly visible - then it's instead a case of looking for "ContainerData" inside the Save-game Manager's Player Remember data section.

  • Hello, ok so I took a break from this particular issue to get some progress done in other areas.

    The problem persists, but one discovery I made is that the container item is saved/load properly only in the first scene I load the game in. So whenever I change scenes in-game and try to save-load, the container item will be missing. This means it's not really the scene itself that causes the issue.

  • It's been a while - how are your Containers surviving scene changes? Via the script attached that calls DontDestroyOnLoad for its GameObject, or as part of the Player prefab? Please share any screenshots you can to illustrate the issue.

    Both of these methods are to make sure that the Container becomes part of the DontDestroyOnLoad scene in the Hiearchy at runtime. This should also cause their save data to be listed either under the "Persistent data" section of the Save-game file Manager (if using a script), or under "Player data" (if attached to the Player), but not under "Scene data".

    You'll also need to make sure that the scene that they start from isn't loaded again - otherwise you'll end up with duplicates since a new set will be made persistent each time the scene opens. To get around this, you can remove them from the scene file itself, and spawn them in with the Object: Add or remove Action in your "ActionList when start game" asset file assigned in the Settings Manager.

    It may be easiest, though, to attach them as separate child objects on your Player. You'd need to ensure that the Player prefab is consistently used - i.e. no per-scene Players for troublesome scenes - but this step would be necessary anyway to have the visible equipment transfer properly between scenes.

  • Yes, finally!
    Simply putting the containers as a child of the player prefab did the trick! This was exactly the quick and easy solution I was looking for :)
    And your warning about consistent use of the player prefab is noted.

  • edited September 2022

    The only remaining issue here is that it seems I still have to choose between having empty container slots properly highlighted (when navigating the containers), or having the inventory items re-arranged automaticlly instead of leaving gaps when one item is moved to a container.
    But it seems you don't have a fix for this yet?

    Btw, can/should I remove the Don't Destroy Me on the containers, now that they're children of the player prefab, or just leave it as it is?

  • So long as the Player prefab is used throughout, yes - the script can be removed.

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.