Answer the question
In order to leave comments, you need to log in
Why can't unity see the component?
The slider object contains a slider and two buttons + and -. I'm trying to get a component in it (the same on 2 buttons) on 1 button:
ui_btn = btn1.GetComponent<MyComponentBtn>()
ui_btn1 is null although the component was added before the start.
however, I write:
ui_btn = this.gameObject.GetComponentsInChildren<MyComponentBtn>()[0]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question