void CreateNewItemList()
 {
     viewIndex         = 1;
     inventoryItemList = CreateInventoryItemList.Create();
     if (inventoryItemList)
     {
         inventoryItemList.itemList = new List <InventoryItem>();
         string relPath = AssetDatabase.GetAssetPath(inventoryItemList);
         EditorPrefs.SetString("ObjectPath", relPath);
     }
 }
Пример #2
0
 void CreateNewItemList()
 {
     // There is no overwrite protection here!
     // There is No "Are you sure you want to overwrite your existing object?" if it exists.
     // This should probably get a string from the user to create a new name and pass it ...
     viewIndex         = 1;
     inventoryItemList = CreateInventoryItemList.Create();
     if (inventoryItemList)
     {
         inventoryItemList.itemList = new List <InventoryItem>();
         string relPath = AssetDatabase.GetAssetPath(inventoryItemList);
         EditorPrefs.SetString("ObjectPath", relPath);
     }
 }
    void CreateNewItemList()
    {
        // There is no overwrite protection here!
        // There is No "Are you sure you want to overwrite your existing object?" if it exists.
        // This should probably get a string from the user to create a new name and pass it ...

        //Chooses the inventory and sets the viewIndex value
        viewIndex = 1;
        //Creates a new inventoryItemList Scriptable Object
        inventoryItemList = CreateInventoryItemList.Create();
        //if there is an inventoryItemList
        if (inventoryItemList)
        {
            //set the inventoryItemList as a new List of InventoryItem Scriptable Objects
            inventoryItemList.itemList = new List <InventoryItem>();
            //sets a string called relPath using GetAssetPath
            string relPath = AssetDatabase.GetAssetPath(inventoryItemList);
            //Sets the string ObjectPath to be the same as the string relPath
            //This sets the path to the Inventory so that it can be found again
            EditorPrefs.SetString("ObjectPath", relPath);
        }
    }