// Use this for initialization void Start() { Image image = GetComponent <Image>(); image.LoadSprite(bundleName, assetName); NameTable nt = GetComponent <NameTable>(); if (nt != null) { nt.Find("Key1").GetComponent <Image>().LoadSprite("ui/images/playerview.u3dassetbundle", "btn_a"); nt.Find("Key2").GetComponent <Image>().LoadSprite("ui/images/playerview.u3dassetbundle", "btn_b"); nt.Find("Key3").GetComponent <Image>().LoadSprite("ui/images/playerview.u3dassetbundle", "btn_c"); nt.Find("Key4").GetComponent <Image>().LoadSprite("ui/images/playerview.u3dassetbundle", "btn_d"); } }
IEnumerator LoadSprite() { while (enabled) { yield return(null); if (nt != null) { nt.Find("Key1").GetComponent <Image>().LoadSprite("ui/images/playerview.u3dassetbundle", nameList[index % 4]); nt.Find("Key2").GetComponent <Image>().LoadSprite("ui/images/playerview.u3dassetbundle", nameList[index % 4]); nt.Find("Key3").GetComponent <Image>().LoadSprite("ui/images/playerview.u3dassetbundle", nameList[index % 4]); nt.Find("Key4").GetComponent <Image>().LoadSprite("ui/images/playerview.u3dassetbundle", nameList[index % 4]); } index++; } }
void LoadCallBack(UnityEngine.Object obj) { isLoading = false; // 实例化UI根画布 _UICanvas = Instantiate <GameObject>(obj as GameObject); DontDestroyOnLoad(_UICanvas); // 找到不同类型面板的根节点 _NameTable = _UICanvas.GetComponent <NameTable>(); _TraUIRoot = _NameTable.Find("UIRoot").transform; _TraNormalRoot = _NameTable.Find("NormalRoot").transform; _TraFixedRoot = _NameTable.Find("FixedRoot").transform; _TraPopUpRoot = _NameTable.Find("PopUpRoot").transform; isLoaded = true; }