예제 #1
0
        public void CreateEmpty(string name)
        {
            var newInstance = ScriptableObject.CreateInstance <T>();
            // TextField editorPathField;
            string fullPath = ActivePath + "/" + name + ".asset";

            if (AssetDatabase.LoadAllAssetsAtPath(fullPath).Length == 0)
            {
                CruddyAssetDatabaseExtensions.CreateFolderRecursively(ActivePath, new [] { "/" });
                AssetDatabase.CreateAsset(newInstance, fullPath);
                ResetEditor();
            }
        }
예제 #2
0
        public void AddPathForType(Type type, string path)
        {
            if (EditableTypeConfiguredPaths == null)
            {
                EditableTypeConfiguredPaths = new List <TypePathRecord>();
            }

            CruddyAssetDatabaseExtensions.CreateFolderRecursively(path, new[] { "/" });
            if (!EditableTypeConfiguredPaths.Any(p => p.type == type.Name))
            {
                var newRecord = new TypePathRecord();
                newRecord.paths = new List <string>();
                newRecord.type  = type.Name;
                EditableTypeConfiguredPaths.Add(newRecord);
            }

            if (!EditableTypeConfiguredPaths.Any(p => p.paths.Contains(path)))
            {
                EditableTypeConfiguredPaths.First(r => r.type == type.Name).paths.Add(path);
            }

            EditorUtility.SetDirty(this);
            AssetDatabase.SaveAssets();
        }