Hello everyone!
I want to add a On click-Listener to an UIbutton from my script using the following code:
This works fine if the UI button atom has no parent, but fails if another atom is declared as its parent.
I would like to ask if there is a way to do the same if the UI button has a parent atom?
I want to add a On click-Listener to an UIbutton from my script using the following code:
C#:
Atom uiButtonAtom = SuperController.singleton.GetAtomByUid(uiButtonName);
Transform buttonTransform = uiButtonAtom.transform.Find("reParentObject/object/rescaleObject/Canvas/Button");
UnityEngine.UI.Button myButton_1 = buttonTransform.GetComponent<UnityEngine.UI.Button>();
myButton_1.onClick.AddListener(ClickUIButton);
This works fine if the UI button atom has no parent, but fails if another atom is declared as its parent.
I would like to ask if there is a way to do the same if the UI button has a parent atom?