コード例 #1
0
    private void InspectWorld(TerrainSystem terrainSystem)
    {
        if (terrainSystem == null)
        {
            return;
        }
        using (new EditorGUILayout.VerticalScope("Button")) {
            GUI.backgroundColor = Color.white;
            EditorGUILayout.HelpBox("World", MessageType.None);

            terrainSystem.SetSize(EditorGUILayout.Vector2Field("Size", terrainSystem.Size));
            Vector2 resolution = EditorGUILayout.Vector2Field("Resolution", new Vector2(Resolution.x, Resolution.y));
            Resolution = new Vector2i((int)resolution.x, (int)resolution.y);
            if (Resolution.x != terrainSystem.Resolution.x || Resolution.y != terrainSystem.Resolution.y)
            {
                EditorGUILayout.HelpBox("Changing the resolution will reset the world.", MessageType.Warning);
                if (GUILayout.Button("Apply"))
                {
                    terrainSystem.SetResolution(Resolution);
                }
            }
        }
    }