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(); } }
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(); }