- Home /
UI Button OnClick not working, added via script
I am using buttons in a sub menu. When I select an object, a menu appears with two buttons; one is move and one is attack. Below is the hierarchy.
When I select A1, a script attached clones the MenuContainer prefab. I add listeners to each button's OnClick. Code below.
I have checked that there is an EventSystem, the MenuContainer has a Canvas and Raycaster, and there is nothing blocking the input between the camera and button.
capture.png
(32.4 kB)
capture.png
(2.3 kB)
Comment