Item system revamp and the struggles that came with it


Hey everyone,

Victor here again to share another tidbit on the project's development. Back when I first added our collectable item system, I already knew that eventually it'd need some significant touch-ups, mainly with the way item memory is stored.

The way it worked before had it so items would be stored by value and instantiate new copies of themselves whenever needed, this meant that whenever the player collected an instance of the item ScriptableObject and threw it, for example,  it'd create another copy of it in memory.

In order to remove those unnecessary copies, I begin working with disabling and re-enabling the game objects rather than destroying and recreating them, which led into another issue where each scriptable object instance should store a reference to its gameobject, which I did so in Awake. By the end of that, the new system was working fine, preventing overuse of memory.

See you all in the next one, bye.

Leave a comment

Log in with itch.io to leave a comment.