Forum rules - please read before posting.

Saving inventory items

Saving inventory items:
I pickup and item on a table that then goes into inventory by using the actions inventory add + save autosave. The item goes into the inventory as expected.
The problem, when I stop the Editor, and then press play again, then the item is back on the table, and not in inventory.

I have added Remember Animation and Remember Variable on doors, and they work as expected, so the save/load process obviously works.

How to fix this so the item is in the inventory and not on the table when restarting the Editor ?

Comments

  • Welcome to the community, @bud.

    You'll need to attach the appropriate Remember component to the item's object in the scene - depending on how you're removing it when the Player takes it.

    If you're using the Object: Teleport Action to teleport it out of the way (the easiest approach), you can attach the Remember Transform component to record its position in the save-game file.

    If you're using the Object: Add or remove Action to remove the object from the scene, you'd have to use the Remember Transform component's Save scene presence? option, and then configure the object to be a prefab that AC can respawn. More on this topic can be found in the Manual's "Saving asset references" chapter.

    I'd recommend the first technique, however, and simply teleport the object out of view. I cover this approach here as part of AC's 2D tutorial video.

    It's also worth mentioning that the process of attaching the correct Remember components to your scene objects can be automated, via the Auto-add save components to GameObjects button in the Settings Manager. This will have AC go through all scenes in your Build Settings and attempt to add what it can see is necessary.

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.