public void Resize(int width, int height) { Texture2DArray prevTexArr = texArr; texArr = texArr.ResizedClone(width, height); ApplyAllSources(); Rewrite(prevTexArr, texArr); }
public static void EqualizeResDialog(ref Texture2DArray texArr, ref Texture2D tex) { #if UNITY_EDITOR int resizeChoise = UnityEditor.EditorUtility.DisplayDialogComplex( "Resize the texture array?", "Loaded texture size (" + tex.width + "," + tex.height + ") does not match the texture array size (" + texArr.width + "," + texArr.height + ")." + "Do you want to resize the texture array?", ok: "Yes, use " + tex.width + "," + tex.height + "", cancel: "No, use " + texArr.width + "," + texArr.height + "", //cancel and alt are switched alt: "Cancel"); switch (resizeChoise) { case 0: texArr = texArr.ResizedClone(tex.width, tex.height); break; case 1: tex = tex.ResizedClone(texArr.width, texArr.height); break; case 2: return; default: return; } #endif }