public void LoadSources() { #if UNITY_EDITOR if (texArr == null || texArr.Equals(null) || !UnityEditor.AssetDatabase.Contains(texArr)) { Debug.Log("Texture Array is not an asset: could not get source tex"); return; } string[] sourceGuids = texArr.GetUserData("TexArr_sourceLayers"); string[] alphaGuids = texArr.GetUserData("TexArr_alphaLayers"); if (sourceGuids.Length != texArr.depth || alphaGuids.Length != texArr.depth) { //throw new System.Exception("Source GUIDs array length is not equal to TexArr depth"); sourceGuids = new string[texArr.depth]; alphaGuids = new string[texArr.depth]; } srcArr = new SrcLayer[texArr.depth]; for (int i = 0; i < sourceGuids.Length; i++) { if (sourceGuids[i] == null || sourceGuids[i].Length == 0) { continue; } srcArr[i].source = sourceGuids[i].GUIDtoObj <Texture2D>(); if (alphaGuids[i] == null || alphaGuids[i].Length == 0) { continue; } srcArr[i].alpha = alphaGuids[i].GUIDtoObj <Texture2D>(); } #endif }