예제 #1
0
        private void OnGUI()
        {
            target   = EditorGUILayout.ObjectField("Target", target, typeof(MeshFilter), true) as MeshFilter;
            meshName = EditorGUILayout.TextField("Mesh name", meshName);
            fileType = (MeshSaver.FileType)EditorGUILayout.EnumPopup("File type", fileType);
            EditorCommon.BrowseFolder("Path", ref path);
            GUI.enabled =
                target != null &&
                target.sharedMesh != null &&
                !string.IsNullOrEmpty(meshName) &&
                !string.IsNullOrEmpty(path);
            if (EditorCommon.RightAnchoredButton("Save"))
            {
                Material     mat = null;
                MeshRenderer mr  = target.GetComponent <MeshRenderer>();
                if (mr != null)
                {
                    mat = mr.sharedMaterial;
                }
                MeshSaver.Save(target.sharedMesh, mat, path, meshName, fileType);
            }
            GUI.enabled = true;

            EditorCommon.Separator();
            showAd = EditorGUILayout.Foldout(showAd, "Introducing Polaris Ecosystem - The complete toolset for immersive Low Poly levels.");

            if (showAd)
            {
                if (GUILayout.Button("Polaris - Low Poly Terrain"))
                {
                    Application.OpenURL("https://assetstore.unity.com/packages/tools/terrain/low-poly-terrain-polaris-2020-170400?aid=1100l3QbW&pubref=mesh-to-file");
                }
                if (GUILayout.Button("Poseidon - Low Poly Water"))
                {
                    Application.OpenURL("https://assetstore.unity.com/packages/vfx/shaders/substances/poseidon-low-poly-water-system-builtin-lwrp-153826?aid=1100l3QbW&pubref=mesh-to-file");
                }
                if (GUILayout.Button("Jupiter - Procedural Sky"))
                {
                    Application.OpenURL("https://assetstore.unity.com/packages/2d/textures-materials/sky/procedural-sky-builtin-lwrp-urp-jupiter-159992?aid=1100l3QbW&pubref=mesh-to-file");
                }

                Texture2D bg = Resources.Load <Texture2D>("Background");
                if (bg != null)
                {
                    Rect bgRect = GUILayoutUtility.GetAspectRect(bg.width * 1.0f / bg.height);
                    GUI.DrawTexture(bgRect, bg);
                }
            }
        }
예제 #2
0
        private void OnGUI()
        {
            target   = EditorGUILayout.ObjectField("Target", target, typeof(MeshFilter), true) as MeshFilter;
            meshName = EditorGUILayout.TextField("Mesh name", meshName);
            fileType = (MeshSaver.FileType)EditorGUILayout.EnumPopup("File type", fileType);
            EditorCommon.BrowseFolder("Path", ref path);
            GUI.enabled =
                target != null &&
                target.sharedMesh != null &&
                !string.IsNullOrEmpty(meshName) &&
                !string.IsNullOrEmpty(path);
            if (EditorCommon.RightAnchoredButton("Save"))
            {
                Material     mat = null;
                MeshRenderer mr  = target.GetComponent <MeshRenderer>();
                if (mr != null)
                {
                    mat = mr.sharedMaterial;
                }
                MeshSaver.Save(target.sharedMesh, mat, path, meshName, fileType);
            }
            GUI.enabled = true;

            EditorCommon.Separator();
            showAd = EditorGUILayout.Foldout(showAd, "This package is a part of the amazing Polaris - Low Poly Terrain Engine");

            if (showAd)
            {
                if (GUILayout.Button("Polaris Starter - FREE"))
                {
                    Application.OpenURL("https://assetstore.unity.com/packages/slug/134981");
                }
                if (GUILayout.Button("Polaris Basic"))
                {
                    Application.OpenURL("https://assetstore.unity.com/packages/tools/terrain/polaris-lite-procedural-low-poly-terrain-engine-118854?aid=1100l3QbW");
                }
                if (GUILayout.Button("Polaris Pro"))
                {
                    Application.OpenURL("https://assetstore.unity.com/packages/tools/terrain/polaris-low-poly-terrain-engine-123717?aid=1100l3QbW");
                }

                Texture2D bg = Resources.Load <Texture2D>("Background");
                if (bg != null)
                {
                    Rect bgRect = GUILayoutUtility.GetAspectRect(bg.width * 1.0f / bg.height);
                    GUI.DrawTexture(bgRect, bg);
                }
            }
        }