Beispiel #1
0
        public static void CreateNewItem()
        {
            var path       = ElementHelper.GetSelectedPathOrFallback();
            var type       = Type.GetType("Oc.Item.ItemData,Assembly-CSharp");
            var newItem    = ScriptableObject.CreateInstance(type);
            var serialized = new SerializedObject(newItem);

            serialized.Update();
            serialized.FindProperty("status").intValue           = 1;
            serialized.FindProperty("maxStack").intValue         = 100;
            serialized.FindProperty("price").intValue            = 1;
            serialized.FindProperty("rarity").intValue           = 1;
            serialized.FindProperty("playerCraftCount").intValue = 1;
            serialized.FindProperty("carftTimeCost").floatValue  = 3;
            serialized.ApplyModifiedProperties();
            AssetDatabase.CreateAsset(newItem, Path.Combine(path, "NewItem.asset"));
            AssetDatabase.SaveAssets();
        }
Beispiel #2
0
 public static bool ValidCreateNewItem()
 {
     return(ElementHelper.ExistsAssembly());
 }