Esempio n. 1
0
        public static GridStorageObject CreateAsset()
        {
            GridStorageObject asset = ScriptableObject.CreateInstance <GridStorageObject>();

            AssetDatabase.CreateAsset(asset, GetGridAssetPath());
            AssetDatabase.SaveAssets();

            EditorUtility.FocusProjectWindow();

            Selection.activeObject = asset;
            return(asset);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }