alright, following difficulty with converting slices sprites to textures, I decided to build an editor window to do this. So far, I have a way to load up a texture, display divider lines, and set how many textures there are in the atlas. I've hit a bit of a snag. When I set the texture count greater than the x axis dimensions, the display just continues adding tiles to the right, and I can't work out how to get it to drop down, so I can get the other rows. This is kind of difficult to explain so I'm just going to attach my script below. I believe this bug is on line 246, but I can't work out for the life of me how to fix it. I've tried many combinations of calculations for the Rect locations and can't work it out. Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; using System; public class ArcaneAtlasSlicer : EditorWindow { private Vector2 _scrollPosition; private Vector2 _scrollPosition2; bool debugSect; bool texSect; private List<Texture2D> slicedTextures; Color headerColor = new Color(0.65f, 0.65f, 0.65f, 1); GUIStyle btnSmall; Texture2D activeTexture; Vector2 atlasDimensions = new Vector2(1f, 1f); int atlasTextureCnt; Color debugLineColor = Color.white; bool debugLines = true; Color debugTexColor = new Color(1f, 0.5f, 0.5f, 1.0f); bool debugTexs = true; bool example; [MenuItem("Arcane Engine/Atlas Slicer", false, 102)] public static void Init() { EditorWindow arcaneSlicer = GetWindow(typeof(ArcaneAtlasSlicer), false, "Arc Slicer"); arcaneSlicer.Show(); } void OnInspectorUpdate() { Repaint(); } void OnGUI() { #region setup Rect texRect = new Rect((position.width / 4) / 2, (position.height - ((position.width / 4) * 2)) / 2, (position.width / 4) * 2, (position.width / 4) * 2); btnSmall = new GUIStyle("ShurikenModuleTitle"); btnSmall.fixedHeight = 20; btnSmall.fixedWidth = 20; btnSmall.padding = new RectOffset(-10, 0, 0, 0); btnSmall.margin = new RectOffset(0, 4, 2, 0); #endregion Vector2 tmpDimensions = new Vector2((float)Math.Truncate(atlasDimensions.x), (float)Math.Truncate(atlasDimensions.y)); if (tmpDimensions.x < 1) { tmpDimensions.x = 1; } if (tmpDimensions.y < 1) { tmpDimensions.y = 1; } atlasDimensions = tmpDimensions; if (atlasTextureCnt < 1) { atlasTextureCnt = 1; } if (atlasTextureCnt > tmpDimensions.x * tmpDimensions.y) { atlasTextureCnt = (int)(tmpDimensions.x * tmpDimensions.y); } if (!EditorGUIUtility.isProSkin) { headerColor = new Color(165 / 255f, 165 / 255f, 165 / 255f, 1); //backgroundColor = new Color(193 / 255f, 193 / 255f, 193 / 255f, 1); } else { headerColor = new Color(41 / 255f, 41 / 255f, 41 / 255f, 1); //backgroundColor = new Color(56 / 255f, 56 / 255f, 56 / 255f, 1); } GUIStyle labelCentred = new GUIStyle("Label"); labelCentred.alignment = TextAnchor.MiddleCenter; GUIStyle bigLabelCentre = new GUIStyle("Label"); bigLabelCentre.alignment = TextAnchor.MiddleCenter; bigLabelCentre.fontSize = 20; bigLabelCentre.stretchHeight = true; bigLabelCentre.stretchWidth = true; Texture2D backg = new Texture2D(1, 1, TextureFormat.RGBA32, false); backg.SetPixel(0, 0, new Color(0.30f, 0.30f, 0.30f, 1.0f)); backg.Apply(); Texture2D debugBg = new Texture2D(1, 1, TextureFormat.RGBA32, false); debugBg.SetPixel(0, 0, debugTexColor); debugBg.Apply(); EditorGUILayout.BeginHorizontal(); //Begin Whole Window #region Sidebar EditorGUILayout.BeginVertical(GUILayout.Width(position.width / 4)); //Begin Sidebar _scrollPosition2 = GUILayout.BeginScrollView(_scrollPosition2); GUI.DrawTexture(new Rect(0, 0, position.width / 4, position.height), backg, ScaleMode.StretchToFill); EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true)); { GUILayout.Label("Menu", labelCentred); } EditorGUILayout.EndHorizontal(); //Texture GUILayout.Label("Atlas", EditorStyles.boldLabel); activeTexture = (Texture2D)EditorGUILayout.ObjectField("Atlas Texture", activeTexture, typeof(Texture2D), true); using (new EditorGUILayout.HorizontalScope()) { GUI.backgroundColor = Color.red; if (GUILayout.Button("Clear Atlas Texture")) { activeTexture = null; } GUI.backgroundColor = Color.white; } EditorGUILayout.Space(); //Settings GUILayout.Label("Atlas Settings", EditorStyles.boldLabel); atlasDimensions = EditorGUILayout.Vector2Field("Atlas Dimensions", atlasDimensions); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label(""); if (GUILayout.Button(new GUIContent("+", "x + 1"))) { atlasDimensions.x++; } if (GUILayout.Button(new GUIContent("-", "x - 1"))) { atlasDimensions.x--; } GUILayout.Label(""); if (GUILayout.Button(new GUIContent("+", "y + 1"))) { atlasDimensions.y++; } if (GUILayout.Button(new GUIContent("-", "y - 1"))) { atlasDimensions.y--; } } EditorGUILayout.HelpBox("The dimensions the atlas will be divided by. 4 images in a 2x2 grid would be x2 y2 (use whole numbers).", MessageType.None); atlasTextureCnt = EditorGUILayout.IntField("Atlas Texture Count", atlasTextureCnt); using (new EditorGUILayout.HorizontalScope()) { GUILayout.Label(""); if (GUILayout.Button(new GUIContent("+", "Texture count + 1"))) { atlasTextureCnt++; } if (GUILayout.Button(new GUIContent("-", "Texture count - 1"))) { atlasTextureCnt--; } } EditorGUILayout.HelpBox("The total number of individual textures in the atlas (allows blank spaces to be ignored).", MessageType.None); EditorGUILayout.Space(); debugSect = Foldout("Debug", debugSect); if (debugSect) { debugLines = EditorGUILayout.Toggle("Debug Lines", debugLines); debugLineColor = EditorGUILayout.ColorField("Line Color", debugLineColor); debugTexs = EditorGUILayout.Toggle("Debug Textures", debugTexs); debugTexColor = EditorGUILayout.ColorField("Texture Color", debugTexColor); } //Build sliced Images texSect = Foldout("Textures", texSect); if(texSect) { if(slicedTextures.Count <= 0) { GUILayout.Label("No sliced textures available."); } for(int i = 0; i < atlasTextureCnt; i++) { slicedTextures[i] = (Texture2D)EditorGUILayout.ObjectField(i.ToString() + " Sliced", slicedTextures[i], typeof(Texture2D), true); slicedTextures[i] = activeTexture; } if(slicedTextures.Count > 0) { GUI.backgroundColor = Color.green; if(GUILayout.Button("Export Textures")) { } GUI.backgroundColor = Color.white; } } GUILayout.EndScrollView(); EditorGUILayout.EndVertical(); //End Sidebar #endregion #region Main Window EditorGUILayout.BeginVertical(); //Begin Main Window _scrollPosition = GUILayout.BeginScrollView(_scrollPosition); EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true)); { GUILayout.Label("Arcane Engine Atlas Slicer", labelCentred); } EditorGUILayout.EndHorizontal(); if (activeTexture == null) { //Display Error GUILayout.Label("No Atlas Selected", bigLabelCentre); } else { //Display Texture GUI.DrawTexture(texRect, activeTexture); //Draw Bounding Lines Handles.BeginGUI(); //Generate Debugs if (debugTexs) { for (int i = 0; i < atlasTextureCnt; i++) { GUIStyle tmpTex = new GUIStyle("Label"); tmpTex.fontSize = 15; tmpTex.contentOffset = new Vector2(texRect.xMin, texRect.yMin + texRect.height / atlasDimensions.y * i); GUI.DrawTexture(new Rect(texRect.x + texRect.width / atlasDimensions.x * i, texRect.y, texRect.width / atlasDimensions.x, texRect.height / atlasDimensions.y), debugBg, ScaleMode.StretchToFill); } } Handles.color = debugLineColor; Handles.DrawLine(new Vector3(texRect.xMin - 20, texRect.yMin), new Vector3(texRect.xMax + 20, texRect.yMin)); //Top Horizontal Handles.DrawLine(new Vector3(texRect.xMax, texRect.yMin - 20), new Vector3(texRect.xMax, texRect.yMax + 20)); //Bottom Horizontal Handles.DrawLine(new Vector3(texRect.xMin, texRect.yMin - 20), new Vector3(texRect.xMin, texRect.yMax + 20)); //Left Vertical Handles.DrawLine(new Vector3(texRect.xMin - 20, texRect.yMax), new Vector3(texRect.xMax + 20, texRect.yMax)); //Right Vertical if (debugLines) { //Draw Vertical Dimension Handles for (int i = 1; i < atlasDimensions.x; i++) { Handles.DrawLine(new Vector3(texRect.xMin + texRect.width / atlasDimensions.x * i, texRect.yMin), new Vector3(texRect.xMin + texRect.width / atlasDimensions.x * i, texRect.yMax)); } //Draw Horizontal Dimension Handles for (int i = 1; i < atlasDimensions.y; i++) { Handles.DrawLine(new Vector3(texRect.xMin, texRect.yMin + texRect.height / atlasDimensions.y * i), new Vector3(texRect.xMax, texRect.yMin + texRect.height / atlasDimensions.y * i)); } } Handles.EndGUI(); } GUILayout.EndScrollView(); EditorGUILayout.EndVertical(); //End Main Window #endregion EditorGUILayout.EndHorizontal(); //End Whole Window } public static bool Foldout(string title, bool display) { var style = new GUIStyle("ShurikenModuleTitle"); style.font = new GUIStyle(EditorStyles.label).font; style.border = new RectOffset(15, 7, 4, 4); style.fixedHeight = 22; style.contentOffset = new Vector2(20f, -2f); var rect = GUILayoutUtility.GetRect(16f, 22f, style); GUI.Box(rect, title, style); var e = Event.current; var toggleRect = new Rect(rect.x + 4f, rect.y + 2f, 13f, 13f); if (e.type == EventType.Repaint) { EditorStyles.foldout.Draw(toggleRect, false, false, display, false); } if (e.type == EventType.MouseDown && rect.Contains(e.mousePosition)) { display = !display; e.Use(); } return display; } }