private void CreateRawImage() { var rawImageObj = new CRawImage(); rawImageObj.CreateRawImageWithDefaultSettings(); }
private static void RemoveUIConjunction(Object asset) { if (asset is GameObject) { GameObject UI = asset as GameObject; Image[] images = UI.GetComponentsInChildren <Image>(true); if (images != null && images.Length > 0) { for (int i = 0; i < images.Length; i++) { if (images[i] is CImage) { continue; } EditorUtility.DisplayDialog("Error", asset.name + "包含Image,请执行>> UI脚本更换 <<", "OK"); return; } } Text[] textarray = UI.GetComponentsInChildren <Text>(true); if (textarray != null && textarray.Length > 0) { for (int i = 0; i < textarray.Length; i++) { if (textarray[i] is CText) { continue; } EditorUtility.DisplayDialog("Error", asset.name + "包含Text,请执行>> UI脚本更换 <<", "OK"); return; } } CImage[] sprites = UI.GetComponentsInChildren <CImage>(true); for (int j = 0; j < sprites.Length; j++) { CImage sprite = sprites[j]; sprite.sprite = null; } CRawImage[] RawImages = UI.GetComponentsInChildren <CRawImage>(true); for (int j = 0; j < RawImages.Length; j++) { CRawImage rawImage = RawImages[j]; if (rawImage.IsLoad) { continue; } rawImage.texture = null; } CText[] texts = UI.GetComponentsInChildren <CText>(true); for (int j = 0; j < texts.Length; j++) { texts[j].material = null; texts[j].font = null; } AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); } }