using System.Collections;

using System.Collections.Generic;

using UnityEngine;


public class Inventory : MonoBehaviour

{

ย  ย  public static Inventory instance;


ย  ย  [SerializeField]

ย  ย  public List<Item> items = new List<Item>();


ย  ย  private void Awake()

ย  ย  {

ย  ย  ย  ย  instance = this;

ย  ย  }

}


using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using System.IO;


[System.Serializable]

public enum ItemType

{

ย  ย  Equipment,

ย  ย  Consumables,

ย  ย  Etc

}

[System.Serializable]

public class Item

{

ย  ย  public ItemType itemType;

ย  ย  public string itemName;

ย  ย  public Sprite itemImage;

ย  ย  public int itemNumber;


ย  ย  public bool Use()

ย  ย  {

ย  ย  ย  ย  return false;

ย  ย  }

}


using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using System.IO;

public class savedata : MonoBehaviour

{

ย  ย  public Item item = new Item();

ย  ย  public void SaveInventory()

ย  ย  {

ย  ย  ย  ย  string json = JsonUtility.ToJson(Inventory.instance.items);


ย  ย  ย  ย  string filePath = Application.persistentDataPath + "/savetest.json";


ย  ย  ย  ย  File.WriteAllText(filePath, json);


ย  ย  ย  ย  Debug.Log("saved");

ย  ย  }

}

a16711aa372a76b660b8f68b12d21a1dd68ad932c0


a16711aa372a69e87eb1d19528d5270300b2e7c000

items ์— ์ž„์˜๋กœ ๊ฐ’์„ ๋„ฃ์–ด๋„ ์ด๋ ‡๊ฒŒ ์ €์žฅ์ด ๋˜๋Š”๋ฐ ์ด๊ฑฐ ์ด์œ ๋ž‘ ํ•ด๊ฒฐ๋ฐฉ๋ฒ• ์•„์‹œ๋Š” ๋ถ„ ์žˆ๋‚˜์š” ์ด์œ ๋งŒ์ด๋ผ๋„ ์ œ๋ฐœ..

ํ˜ผ์ž ์œ ํŠœ๋ธŒ ๋ณด๋ฉด์„œ ๋ฐฐ์šธ๋ ค๋‹ˆ๊นŒ ํž˜๋“œ๋„ค์š”