Exemple #1
0
        private void CreateSceneAssets()
        {
            if (gridBase.meshFilter == null)
            {
                gridBase.meshFilter = gridBase.GetComponent <MeshFilter>();
            }

            if (gridBase.meshFilter.sharedMesh == null)
            {
                CreateMeshAsset();

                // Create GridStorage Asset
                gridBase.storage = GridStorageObjectFactory.CreateAsset();
            }
        }
        private void CreateSceneAssets()
        {
            if (gridBase.meshFilter == null)
            {
                gridBase.meshFilter = gridBase.GetComponent <MeshFilter>();
            }

            if (gridBase.meshFilter.sharedMesh == null)
            {
                // Create Mesh Asset
                Mesh newMesh = new Mesh();
                Undo.RegisterCreatedObjectUndo(newMesh, "MeshFilter mesh change");
                gridBase.meshFilter.sharedMesh = newMesh;
                AssetDatabase.CreateAsset(gridBase.meshFilter.sharedMesh, RESOURCES_PATH + EditorSceneManager.GetActiveScene().name + "_Mesh.asset");
                AssetDatabase.SaveAssets();

                // Create GridStorage Asset
                gridBase.storage = GridStorageObjectFactory.CreateAsset();
            }
        }