What is the best way to manage Items in game?

I’m writing a code for an inventory manager for my game, and I was wondering what would be the best way to handle all the items that would be in the game. I came up with two solutions for this.

  1. load all items from a text/xml file, and keep them in memory for the duration of a game session.
  2. Load the Item text/xml file retrieve the item that I want to get then dispose of the list.

So which method would be better. I’m not sure since I have never made a game that needed an inventory system before. Also I should mention that in my game I will be considering skills that my character use as items as well.

Try using unity’s PlayerPrefs class. I find it very useful to manage the items and different states in the game.