Stackable Item Saving System Chaos

Alright so I was recently working with @bixarrio on a new crafting system, and whilst we have reached some new heights, our saving system for STACKABLE items, be it the quiver, logs, or basically anything that is stackable, cannot be saved properly anymore. Instead, it goes through 2 different phases of nightmare (and believe me I am clueless as of why, but I’m trying different things out), as follows:

  • Phase 1: when I first save and quit, the ammo in the Quiver Slot of my Equipment, if they’re in the Quiver Slot, are permanently gone, no negotiations. If they’re in the inventory, however, the item itself disappears, but the stack number it had on it remains, and unfortunately this causes me some serious issues, because if any other item falls in this slot (be it stackable or non-stackable), and we click on it, it will duplicate itself for as many times as the stack number was (and this goes for all inventory systems, like the bank, that start off as an Inventory duplicate
  • Phase 2: the items’ leftover stack number is permanently gone, and this item is as good as gone

This issue is now a major glitch in my game, and I desperately need help fixing them :confused: (I don’t think Bixarrio’s InventoryExtension has anything to do with this, because commenting it out did not fix the issue either)

Let’s see your CaptureState/RestoreState() for Quiver (or CaptureAsJToken, I can’t remember if we’ve gotten you upgraded yet).

Oooh… is your AmmunnitionItem in a Resources folder?

public JToken CaptureAsJToken() {

            JObject state = new JObject {

                [nameof(currentAmmunition)] = currentAmmunition != null ? currentAmmunition.GetItemID() : "",
                [nameof(amount)] = amount

            return state;


        public void RestoreFromJToken(JToken state) {

            currentAmmunition = null;
            amount = 0;

            if (state is JObject stateDict) {

                if (stateDict.TryGetValue(nameof(currentAmmunition), out JToken token)) {

                    var item = InventoryItem.GetFromID(token.ToString());

                    if (item is AmmunitionItem ammunitionItem) {

                        currentAmmunition = ammunitionItem;

                        if (stateDict.TryGetValue(nameof(amount), out JToken amountToken) && 
                        int.TryParse(amountToken.ToString(), out int number)) {

                            amount = number;







SOO… I was being Traumatized because my Ammo was not in the Resources folder… got it (I’ll thoroughly check my systems again now, but yes this was the problem). Serious question though, I might be forgetting stuff, but when do we exactly need to use the resources folder so our stuff does not go missing out of thin air?

Systems are fine, back to the Quiver issue of ours xD

Anything that is a ScriptableObject that we save and restore using an ItemID (i.e. InventoryItems and anything that is derived from an InventoryItem, as well as Quests).

So anything that we create from the ‘Right Click’ menu through what we coded (i.e: a Scriptable Object) must ALWAYS be in a resources folder, right? (for simplicity’s sake with the terms for the moment)

No, because Dialogues, for example, are NOT saved and loaded, and those are ScriptableObjects. You only want to use Resources when it’s necessary, meaning you only want things that will be loaded with Resources.Load() or Resources.LoadAll(), which is InventoryItems and Quests.

And Recipes


I had 4 classes in a row, and tomorrow it’ll be 6 in a row…

Anyway, so Crafting Recipes, InventoryItems and and Quests are what go into Resources folders… got it

Privacy & Terms