- Home /
Question by
brianchan661 · Jul 14, 2015 at 05:33 PM ·
ui
get ugui prefab's child
I have an ugui prefab instantiate by code and want to get its child as reference.
My prefab is grouped as:
myCanvas
--Image1
--Image2
--Text1
I try to get it by findchild but getting the error
Cannot convert type UnityEngine.Transform' to UnityEngine.UI.Image'
Image speechUIImage;
Text speechUiText;
void Start () {
GameObject speechUI = Resources.Load ("SpeechUI/SpeechUIObject") as GameObject;
Instantiate (speechUI);
speechUIImage = speechUI.transform.FindChild ("Image");
}
Comment
Your answer
Follow this Question
Related Questions
ugui, onclick, acceptable function signatures 2 Answers
[uGUI] Performance on Color Lerping 0 Answers
How to set PosX and PosY in runtime UGUI 4 Answers
Blocking and not blocking input in new uGUI 4.6 1 Answer
Get width of uGUI text object 1 Answer