Recommended Posts

JSON. Absolute life saver. You can essentially build a list of classes that will act as 'items'.

Depending on what you're using C# or TS or JS. These are mostly for TS/C# though.

C#

public class InventoryItem {
	public int ID;
	public string Name;
	public int StackCount = 1;

	public InventoryItem(int itemID, string itemName, int itemCount) {
		ID = itemID;
		Name = itemName;
		StackCount = itemCount;
	}
}

Then you create a list of these items that the player has somewhere or pull them from a database end use JSONConvert to serialize or deserialize the list. Really straight forward.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.