コード例 #1
0
        private bool _validateTilesetTextures(AtlasSlot atlasSlot)
        {
            //+++ old values for 32x32 tiles, now depend on tile size
            int _512 = 16 * m_autoTileset.TileWidth;
            int _480 = 15 * m_autoTileset.TileWidth;
            int _384 = 12 * m_autoTileset.TileWidth;
            int _256 = 8 * m_autoTileset.TileWidth;
            //---

            List <Texture2D> invalidTextures = new List <Texture2D>();

            Debug.Log("atlasSlot.SubTilesets.Count   " + atlasSlot.SubTilesets.Count);
            for (int i = 0; i < atlasSlot.SubTilesets.Count; ++i)
            {
                SubTilesetConf tilesetConf = atlasSlot.SubTilesets[i];
                if (tilesetConf.HasAutotiles)
                {
                    Debug.Log(tilesetConf.SourceTexture.Length);
                    for (int j = 0; j < tilesetConf.SourceTexture.Length; ++j)
                    {
                        if (tilesetConf.SourceTexture[j] != null &&
                            (
                                (j == 0) && (tilesetConf.SourceTexture[j].width != _512 || tilesetConf.SourceTexture[j].height != _384) ||
                                (j == 1) && (tilesetConf.SourceTexture[j].width != _512 || tilesetConf.SourceTexture[j].height != _384) ||
                                (j == 2) && (tilesetConf.SourceTexture[j].width != _512 || tilesetConf.SourceTexture[j].height != _256) ||
                                (j == 3) && (tilesetConf.SourceTexture[j].width != _512 || tilesetConf.SourceTexture[j].height != _480) ||
                                (j == 4) && (tilesetConf.SourceTexture[j].width != _256 || tilesetConf.SourceTexture[j].height != _512)
                            )
                            )
                        {
                            invalidTextures.Add(tilesetConf.SourceTexture[j]);
                            tilesetConf.SourceTexture[j] = null;
                        }
                    }
                }
                else
                {
                    if (tilesetConf.SourceTexture[0] != null && (tilesetConf.SourceTexture[0].width != _512 || tilesetConf.SourceTexture[0].height != _512))
                    {
                        invalidTextures.Add(tilesetConf.SourceTexture[0]);
                        tilesetConf.SourceTexture[0] = null;
                    }
                }
            }
            if (invalidTextures.Count > 0)
            {
                string wrongTextures = "";
                foreach (Texture2D text in invalidTextures)
                {
                    wrongTextures += "\n" + text.name;
                }
                EditorUtility.DisplayDialog(
                    "Wrong texture size", "One or more textures have a wrong texture size:" + wrongTextures + "\n" +
                    "The texture size could be changed by the import settings. If this is the case, use Texture Type: Sprite in the texture import settings."
                    , "Ok");
            }
            return(invalidTextures.Count == 0);
        }
コード例 #2
0
        void OnGUI_TilesetAtlas(bool isFirstUpdate)
        {
            GUILayout.Label("Tileset Atlas Configuration", EditorStyles.boldLabel);

            GUILayout.BeginHorizontal();
            GUI.backgroundColor = m_atlasEditMode == eAtlasEditMode.AddAutoTileset? Color.gray : Color.white;
            if (GUILayout.Button("Add AutoTileset", GUILayout.Height(25)))
            {
                m_atlasEditMode = eAtlasEditMode.AddAutoTileset;
            }
            GUI.backgroundColor = m_atlasEditMode == eAtlasEditMode.AddNormalTileset ? Color.gray : Color.white;
            if (GUILayout.Button("Add NormalTileset", GUILayout.Height(25)))
            {
                m_atlasEditMode = eAtlasEditMode.AddNormalTileset;
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUI.backgroundColor = m_atlasEditMode == eAtlasEditMode.EditTileset ? Color.gray : Color.white;
            if (GUILayout.Button("Edit Tileset", GUILayout.Height(25)))
            {
                m_atlasEditMode = eAtlasEditMode.EditTileset;
            }
            GUI.backgroundColor = m_atlasEditMode == eAtlasEditMode.RemoveTileset ? Color.gray : Color.white;
            if (GUILayout.Button("Remove Tileset", GUILayout.Height(25)))
            {
                m_atlasEditMode = eAtlasEditMode.RemoveTileset;
            }
            GUI.backgroundColor = Color.white;
            GUILayout.EndHorizontal();

            int cols = m_autoTileset.AtlasTexture.width / m_autoTileset.TilesetSlotSize;
            //int rows = m_autoTileset.AtlasTexture.height / k_TilesetSlotSize;

            Rect rAtlas = new Rect(0, 0, m_autoTileset.AtlasTexture.width, m_autoTileset.AtlasTexture.height);

            if (rAtlas.width - position.width > rAtlas.height - (position.height - 120f))
            {
                rAtlas.width   = Mathf.Min(position.width, rAtlas.width);
                rAtlas.height *= rAtlas.width / m_autoTileset.AtlasTexture.width;
            }
            else
            {
                rAtlas.height = Mathf.Min((position.height - 120f), rAtlas.height);
                rAtlas.width *= rAtlas.height / m_autoTileset.AtlasTexture.height;
            }

            GUILayout.Box(m_autoTileset.AtlasTexture, GUILayout.Width(rAtlas.width), GUILayout.Height(rAtlas.height));

            Rect     rGuiAtlas = GUILayoutUtility.GetLastRect();
            Vector2  vBtnOff   = new Vector2(0.2f * rGuiAtlas.width / cols, 0.40f * rGuiAtlas.width / cols);
            Rect     rButton   = new Rect(0, 0, rGuiAtlas.width / cols - 2f * vBtnOff.x, rGuiAtlas.width / cols - 2f * vBtnOff.y);
            float    scale     = rAtlas.width / m_autoTileset.AtlasTexture.width;
            GUIStyle btnStyle  = new GUIStyle("button");

            btnStyle.richText  = true;
            btnStyle.fontSize  = (int)(50 * scale);
            btnStyle.fontStyle = FontStyle.Bold;

            for (int i = 0; i < m_autoTileset.AtlasSlots.Count; ++i)
            {
                AtlasSlot atlasSlot = m_autoTileset.AtlasSlots[i];
                Rect      rSlot     = m_autoTileset.CalculateAtlasSlotRectByIdx(i);
                rButton.position = vBtnOff + rGuiAtlas.position + rSlot.position * scale;
                rButton.y        = rGuiAtlas.y + rGuiAtlas.height - (rButton.y - rGuiAtlas.y) - rButton.height;

                if (atlasSlot.SubTilesets.Count == 0)
                {
                    GUI.color = new Color(0f, 0.7f, 1f, 0.8f);
                    Rect rSlotBox = rSlot;
                    rSlotBox.position *= scale;
                    rSlotBox.position += rGuiAtlas.position;
                    rSlotBox.width    *= scale;
                    rSlotBox.height   *= scale;
                    rSlotBox.y         = rGuiAtlas.y + rGuiAtlas.height - (rSlotBox.y - rGuiAtlas.y) - rSlotBox.height;
                    GUI.Box(rSlotBox, "\n\nSlot " + (i + 1));
                }

                GUI.color = new Color(0f, 0.7f, 1f, 0.8f);

                //+++ Show name list
                if (m_atlasEditMode == eAtlasEditMode.None)
                {
                    if (atlasSlot.SubTilesets.Count == 1)
                    {
                        List <string> availableNames = m_autoTileset.CreateAvailableNameList();
                        availableNames.Insert(0, atlasSlot.SubTilesets[0].Name);
                        Rect rPopup  = new Rect(rButton.x, rButton.y, 50, 20); rPopup.position -= vBtnOff;
                        int  nameIdx = EditorGUI.Popup(rPopup, 0, availableNames.ToArray(), new GUIStyle("popup"));
                        atlasSlot.SubTilesets[0].Name = availableNames[nameIdx];
                    }
                    else
                    {
                        for (int j = 0; j < atlasSlot.SubTilesets.Count; ++j)
                        {
                            List <string> availableNames = m_autoTileset.CreateAvailableNameList();
                            availableNames.Insert(0, atlasSlot.SubTilesets[j].Name);
                            Rect rPopup = new Rect(rButton.x, rButton.y, 50, 20); rPopup.position -= vBtnOff;
                            if (j == 0)
                            {
                                rPopup.y += rSlot.height * scale / 2;
                            }
                            else if (j == 2)
                            {
                                rPopup.y += rSlot.height * scale / 2;
                                rPopup.x += rSlot.width * scale / 2;
                            }
                            else if (j == 3)
                            {
                                rPopup.x += rSlot.width * scale / 2;
                            }
                            int nameIdx = EditorGUI.Popup(rPopup, 0, availableNames.ToArray(), new GUIStyle("popup"));
                            atlasSlot.SubTilesets[j].Name = availableNames[nameIdx];
                        }
                    }
                }
                //---

                GUI.color = new Color(.5f, .5f, 0.5f, 0.7f);

                if (m_atlasEditMode == eAtlasEditMode.EditTileset && atlasSlot.SubTilesets.Count >= 1)
                {
                    if (GUI.Button(rButton, "<color=white>" + (atlasSlot.SubTilesets.Count > 1 ? "[+]" : "[A]") + "Edit</color>", btnStyle))
                    {
                        m_editAtlasSlot     = atlasSlot;
                        m_editMode          = eEditMode.ChangeTileset;
                        m_clearSlotOnCancel = false;
                        m_atlasEditMode     = eAtlasEditMode.None;
                    }
                }
                else if (m_atlasEditMode == eAtlasEditMode.RemoveTileset && atlasSlot.SubTilesets.Count >= 1)
                {
                    if (GUI.Button(rButton, "<color=white>" + (atlasSlot.SubTilesets.Count > 1 ? "[+]" : "[A]") + "Remove</color>", btnStyle))
                    {
                        foreach (SubTilesetConf conf in atlasSlot.SubTilesets)
                        {
                            UtilsAutoTileMap.ClearAtlasArea(m_autoTileset.AtlasTexture, (int)conf.AtlasRec.x, (int)conf.AtlasRec.y, (int)conf.AtlasRec.width, (int)conf.AtlasRec.height);
                        }
                        atlasSlot.SubTilesets.Clear();
                        m_autoTileset.BuildSubTilesetsList();
                        EditorUtility.SetDirty(m_autoTileset);
                        if (m_autoTileset.SubTilesets.Count == 0)
                        {
                            m_atlasEditMode = eAtlasEditMode.None;
                        }
                    }
                }
                else if (m_atlasEditMode == eAtlasEditMode.AddAutoTileset && atlasSlot.SubTilesets.Count == 0)
                {
                    if (GUI.Button(rButton, "<color=white>Add AutoTileset</color>", btnStyle))
                    {
                        List <string> availableNames = m_autoTileset.CreateAvailableNameList();
                        atlasSlot.SubTilesets.Add(new SubTilesetConf()
                        {
                            Name = availableNames.Count > 0 ? availableNames[0] : "-", AtlasRec = rSlot, HasAutotiles = true
                        });
                        m_autoTileset.BuildSubTilesetsList();
                        m_editAtlasSlot     = atlasSlot;
                        m_editMode          = eEditMode.ChangeTileset;
                        m_clearSlotOnCancel = true;
                        EditorUtility.SetDirty(m_autoTileset);
                    }
                }
                else if (m_atlasEditMode == eAtlasEditMode.AddNormalTileset && atlasSlot.SubTilesets.Count == 0)
                {
                    if (GUI.Button(rButton, "<color=white>Add Normal Tileset</color>", btnStyle))
                    {
                        List <string> availableNames = m_autoTileset.CreateAvailableNameList();
                        Rect          rect           = new Rect(rSlot.x, rSlot.y, rSlot.width / 2, rSlot.height / 2);
                        atlasSlot.SubTilesets.Add(new SubTilesetConf()
                        {
                            Name = availableNames.Count > 0 ? availableNames[0] : "-", AtlasRec = rect, HasAutotiles = false
                        });
                        rect.y = rSlot.y + rect.height;
                        atlasSlot.SubTilesets.Add(new SubTilesetConf()
                        {
                            Name = availableNames.Count > 1 ? availableNames[1] : "-", AtlasRec = rect, HasAutotiles = false
                        });
                        rect.x = rSlot.x + rect.width;
                        rect.y = rSlot.y;
                        atlasSlot.SubTilesets.Add(new SubTilesetConf()
                        {
                            Name = availableNames.Count > 2 ? availableNames[2] : "-", AtlasRec = rect, HasAutotiles = false
                        });
                        rect.y = rSlot.y + rect.height;
                        atlasSlot.SubTilesets.Add(new SubTilesetConf()
                        {
                            Name = availableNames.Count > 3 ? availableNames[3] : "-", AtlasRec = rect, HasAutotiles = false
                        });
                        m_autoTileset.BuildSubTilesetsList();
                        m_editAtlasSlot     = atlasSlot;
                        m_editMode          = eEditMode.ChangeTileset;
                        m_clearSlotOnCancel = true;
                        EditorUtility.SetDirty(m_autoTileset);
                    }
                }
            }
            GUI.color = Color.white;
            if (m_atlasEditMode != eAtlasEditMode.None && GUILayout.Button("Cancel Action", GUILayout.Height(25)))
            {
                m_atlasEditMode = eAtlasEditMode.None;
            }
        }
コード例 #3
0
        private bool _validateTilesetTextures( AtlasSlot atlasSlot )
        {
            //+++ old values for 32x32 tiles, now depend on tile size
            int _512 = 16 * m_autoTileset.TileWidth;
            int _480 = 15 * m_autoTileset.TileWidth;
            int _384 = 12 * m_autoTileset.TileWidth;
            int _256 = 8 * m_autoTileset.TileWidth;
            //---

            List<Texture2D> invalidTextures = new List<Texture2D>();
            for (int i = 0; i < atlasSlot.SubTilesets.Count; ++i )
            {
                SubTilesetConf tilesetConf = atlasSlot.SubTilesets[i];
                if( tilesetConf.HasAutotiles )
                {
                    for( int j = 0; j < tilesetConf.SourceTexture.Length; ++j )
                    {
                        if ( tilesetConf.SourceTexture[j] != null &&
                            (
                            (j == 0) && (tilesetConf.SourceTexture[j].width != _512 || tilesetConf.SourceTexture[j].height != _384) ||
                            (j == 1) && (tilesetConf.SourceTexture[j].width != _512 || tilesetConf.SourceTexture[j].height != _384) ||
                            (j == 2) && (tilesetConf.SourceTexture[j].width != _512 || tilesetConf.SourceTexture[j].height != _256) ||
                            (j == 3) && (tilesetConf.SourceTexture[j].width != _512 || tilesetConf.SourceTexture[j].height != _480) ||
                            (j == 4) && (tilesetConf.SourceTexture[j].width != _256 || tilesetConf.SourceTexture[j].height != _512)
                            )
                           )
                        {
                            invalidTextures.Add(tilesetConf.SourceTexture[j]);
                            tilesetConf.SourceTexture[j] = null;
                        }
                    }
                }
                else
                {
                    if ( tilesetConf.SourceTexture[0] != null && (tilesetConf.SourceTexture[0].width != _512 || tilesetConf.SourceTexture[0].height != _512))
                    {
                        invalidTextures.Add(tilesetConf.SourceTexture[0]);
                        tilesetConf.SourceTexture[0] = null;
                    }
                }
            }
            if( invalidTextures.Count > 0 )
            {
                string wrongTextures = "";
                foreach (Texture2D text in invalidTextures) wrongTextures += "\n" + text.name;
                EditorUtility.DisplayDialog(
                    "Wrong texture size", "One or more textures have a wrong texture size:" + wrongTextures + "\n" +
                    "The texture size could be changed by the import settings. If this is the case, use Texture Type: Sprite in the texture import settings."
                    , "Ok");
            }
            return invalidTextures.Count == 0;
        }
コード例 #4
0
        void OnGUI_TilesetAtlas(bool isFirstUpdate)
        {
            GUILayout.Label("Tileset Atlas Configuration", EditorStyles.boldLabel);

            GUILayout.BeginHorizontal();
            GUI.backgroundColor = m_atlasEditMode == eAtlasEditMode.AddAutoTileset? Color.gray : Color.white;
            if (GUILayout.Button("Add AutoTileset", GUILayout.Height(25))) m_atlasEditMode = eAtlasEditMode.AddAutoTileset;
            GUI.backgroundColor = m_atlasEditMode == eAtlasEditMode.AddNormalTileset ? Color.gray : Color.white;
            if (GUILayout.Button("Add NormalTileset", GUILayout.Height(25))) m_atlasEditMode = eAtlasEditMode.AddNormalTileset;
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUI.backgroundColor = m_atlasEditMode == eAtlasEditMode.EditTileset ? Color.gray : Color.white;
            if (GUILayout.Button("Edit Tileset", GUILayout.Height(25))) m_atlasEditMode = eAtlasEditMode.EditTileset;
            GUI.backgroundColor = m_atlasEditMode == eAtlasEditMode.RemoveTileset ? Color.gray : Color.white;
            if (GUILayout.Button("Remove Tileset", GUILayout.Height(25))) m_atlasEditMode = eAtlasEditMode.RemoveTileset;
            GUI.backgroundColor = Color.white;
            GUILayout.EndHorizontal();

            int cols = m_autoTileset.AtlasTexture.width / m_autoTileset.TilesetSlotSize;
            //int rows = m_autoTileset.AtlasTexture.height / k_TilesetSlotSize;

            Rect rAtlas = new Rect(0, 0, m_autoTileset.AtlasTexture.width, m_autoTileset.AtlasTexture.height);

            if (rAtlas.width - position.width > rAtlas.height - (position.height - 120f))
            {
                rAtlas.width = Mathf.Min(position.width, rAtlas.width);
                rAtlas.height *= rAtlas.width / m_autoTileset.AtlasTexture.width;
            }
            else
            {
                rAtlas.height = Mathf.Min((position.height - 120f), rAtlas.height);
                rAtlas.width *= rAtlas.height / m_autoTileset.AtlasTexture.height;
            }

            GUILayout.Box(m_autoTileset.AtlasTexture, GUILayout.Width(rAtlas.width), GUILayout.Height(rAtlas.height));

            Rect rGuiAtlas = GUILayoutUtility.GetLastRect();
            Vector2 vBtnOff = new Vector2(0.2f * rGuiAtlas.width / cols, 0.40f * rGuiAtlas.width / cols);
            Rect rButton = new Rect(0, 0, rGuiAtlas.width / cols -  2f * vBtnOff.x, rGuiAtlas.width / cols - 2f * vBtnOff.y);
            float scale = rAtlas.width / m_autoTileset.AtlasTexture.width;
            GUIStyle btnStyle = new GUIStyle("button");
            btnStyle.richText = true;
            btnStyle.fontSize = (int)(50*scale);
            btnStyle.fontStyle = FontStyle.Bold;

            for (int i = 0; i < m_autoTileset.AtlasSlots.Count; ++i )
            {
                AtlasSlot atlasSlot = m_autoTileset.AtlasSlots[i];
                Rect rSlot = m_autoTileset.CalculateAtlasSlotRectByIdx(i);
                rButton.position = vBtnOff + rGuiAtlas.position + rSlot.position * scale;
                rButton.y = rGuiAtlas.y + rGuiAtlas.height - (rButton.y - rGuiAtlas.y) - rButton.height;

                if (atlasSlot.SubTilesets.Count == 0)
                {
                    GUI.color = new Color(0f, 0.7f, 1f, 0.8f);
                    Rect rSlotBox = rSlot;
                    rSlotBox.position *= scale;
                    rSlotBox.position += rGuiAtlas.position;
                    rSlotBox.width *= scale;
                    rSlotBox.height *= scale;
                    rSlotBox.y = rGuiAtlas.y + rGuiAtlas.height - (rSlotBox.y - rGuiAtlas.y) - rSlotBox.height;
                    GUI.Box(rSlotBox, "\n\nSlot " + (i + 1));
                }

                GUI.color = new Color(0f, 0.7f, 1f, 0.8f);

                //+++ Show name list
                if (m_atlasEditMode == eAtlasEditMode.None)
                {
                    if (atlasSlot.SubTilesets.Count == 1)
                    {
                        List<string> availableNames = m_autoTileset.CreateAvailableNameList();
                        availableNames.Insert(0, atlasSlot.SubTilesets[0].Name);
                        Rect rPopup = new Rect(rButton.x, rButton.y, 50, 20); rPopup.position -= vBtnOff;
                        int nameIdx = EditorGUI.Popup(rPopup, 0, availableNames.ToArray(), new GUIStyle("popup"));
                        atlasSlot.SubTilesets[0].Name = availableNames[nameIdx];
                    }
                    else
                    {
                        for (int j = 0; j < atlasSlot.SubTilesets.Count; ++j)
                        {
                            List<string> availableNames = m_autoTileset.CreateAvailableNameList();
                            availableNames.Insert(0, atlasSlot.SubTilesets[j].Name);
                            Rect rPopup = new Rect(rButton.x, rButton.y, 50, 20); rPopup.position -= vBtnOff;
                            if (j == 0)
                                rPopup.y += rSlot.height * scale / 2;
                            else if (j == 2)
                            {
                                rPopup.y += rSlot.height * scale / 2;
                                rPopup.x += rSlot.width * scale / 2;
                            }
                            else if (j == 3)
                            {
                                rPopup.x += rSlot.width * scale / 2;
                            }
                            int nameIdx = EditorGUI.Popup(rPopup, 0, availableNames.ToArray(), new GUIStyle("popup"));
                            atlasSlot.SubTilesets[j].Name = availableNames[nameIdx];
                        }
                    }
                }
                //---

                GUI.color = new Color(.5f, .5f, 0.5f, 0.7f);

                if (m_atlasEditMode == eAtlasEditMode.EditTileset && atlasSlot.SubTilesets.Count >= 1)
                {
                    if (GUI.Button(rButton, "<color=white>" + (atlasSlot.SubTilesets.Count > 1 ? "[+]" : "[A]") + "Edit</color>", btnStyle))
                    {
                        m_editAtlasSlot = atlasSlot;
                        m_editMode = eEditMode.ChangeTileset;
                        m_clearSlotOnCancel = false;
                        m_atlasEditMode = eAtlasEditMode.None;
                    }
                }
                else if (m_atlasEditMode == eAtlasEditMode.RemoveTileset && atlasSlot.SubTilesets.Count >= 1)
                {
                    if (GUI.Button(rButton, "<color=white>" + (atlasSlot.SubTilesets.Count > 1 ? "[+]" : "[A]") + "Remove</color>", btnStyle))
                    {
                        foreach( SubTilesetConf conf in atlasSlot.SubTilesets )
                        {
                            UtilsAutoTileMap.ClearAtlasArea(m_autoTileset.AtlasTexture, (int)conf.AtlasRec.x, (int)conf.AtlasRec.y, (int)conf.AtlasRec.width, (int)conf.AtlasRec.height);
                        }
                        atlasSlot.SubTilesets.Clear();
                        m_autoTileset.BuildSubTilesetsList();
                        EditorUtility.SetDirty(m_autoTileset);
                        if (m_autoTileset.SubTilesets.Count == 0)
                            m_atlasEditMode = eAtlasEditMode.None;
                    }
                }
                else if (m_atlasEditMode == eAtlasEditMode.AddAutoTileset && atlasSlot.SubTilesets.Count == 0)
                {
                    if (GUI.Button(rButton, "<color=white>Add AutoTileset</color>", btnStyle))
                    {
                        List<string> availableNames = m_autoTileset.CreateAvailableNameList();
                        atlasSlot.SubTilesets.Add(new SubTilesetConf() { Name = availableNames.Count > 0 ? availableNames[0] : "-", AtlasRec = rSlot, HasAutotiles = true });
                        m_autoTileset.BuildSubTilesetsList();
                        m_editAtlasSlot = atlasSlot;
                        m_editMode = eEditMode.ChangeTileset;
                        m_clearSlotOnCancel = true;
                        EditorUtility.SetDirty(m_autoTileset);
                    }
                }
                else if (m_atlasEditMode == eAtlasEditMode.AddNormalTileset && atlasSlot.SubTilesets.Count == 0)
                {
                    if (GUI.Button(rButton, "<color=white>Add Normal Tileset</color>", btnStyle))
                    {
                        List<string> availableNames = m_autoTileset.CreateAvailableNameList();
                        Rect rect = new Rect(rSlot.x, rSlot.y, rSlot.width / 2, rSlot.height / 2);
                        atlasSlot.SubTilesets.Add(new SubTilesetConf() { Name = availableNames.Count > 0 ? availableNames[0] : "-", AtlasRec = rect, HasAutotiles = false });
                        rect.y = rSlot.y + rect.height;
                        atlasSlot.SubTilesets.Add(new SubTilesetConf() { Name = availableNames.Count > 1 ? availableNames[1] : "-", AtlasRec = rect, HasAutotiles = false });
                        rect.x = rSlot.x + rect.width;
                        rect.y = rSlot.y;
                        atlasSlot.SubTilesets.Add(new SubTilesetConf() { Name = availableNames.Count > 2 ? availableNames[2] : "-", AtlasRec = rect, HasAutotiles = false });
                        rect.y = rSlot.y + rect.height;
                        atlasSlot.SubTilesets.Add(new SubTilesetConf() { Name = availableNames.Count > 3 ? availableNames[3] : "-", AtlasRec = rect, HasAutotiles = false });
                        m_autoTileset.BuildSubTilesetsList();
                        m_editAtlasSlot = atlasSlot;
                        m_editMode = eEditMode.ChangeTileset;
                        m_clearSlotOnCancel = true;
                        EditorUtility.SetDirty(m_autoTileset);
                    }
                }
            }
            GUI.color = Color.white;
            if ( m_atlasEditMode != eAtlasEditMode.None && GUILayout.Button("Cancel Action", GUILayout.Height(25))) m_atlasEditMode = eAtlasEditMode.None;
        }