public static GridStorageObject CreateAsset() { GridStorageObject asset = ScriptableObject.CreateInstance <GridStorageObject>(); AssetDatabase.CreateAsset(asset, GetGridAssetPath()); AssetDatabase.SaveAssets(); EditorUtility.FocusProjectWindow(); Selection.activeObject = asset; return(asset); }
public static GridStorageObject LoadAsset() { GridStorageObject result = AssetDatabase.LoadAssetAtPath <GridStorageObject>(GetGridAssetPath()); if (result == null) { Debug.LogError("Your Gridstorage asset was not found at: " + GetGridAssetPath()); Debug.LogError("Delete the reference to your Mesh to automatically create a new Gridstorage object"); } return(result); }
public static GridStorageObject CreateAsset() { GridStorageObject asset = AssetDatabase.LoadAssetAtPath(GetGridAssetPath(), typeof(GridStorageObject)) as GridStorageObject; if (asset == null) { asset = ScriptableObject.CreateInstance <GridStorageObject>(); AssetDatabase.CreateAsset(asset, GetGridAssetPath()); AssetDatabase.SaveAssets(); } EditorUtility.FocusProjectWindow(); Selection.activeObject = asset; return(asset); }