AddListener not working after build
Hi, I try add a function to a button with programmatically, it is working great but unfortunately it is not working after build. I click to button but nothing happens.
AddListener Code;
gameObject.GetComponent<Button>().onClick.AddListener(ChangeText);
public void ChangeText()
{
Debug.Log("Clicked");
gameObject.SetActive(false);
}
It is working in the editor but not working in built exe file after build.
I try it in 2017.3, 2017.1, 5.6.1f1
Comment
Your answer
Follow this Question
Related Questions
How do I make a UI Buttion play an Animation when pressed? 0 Answers
Detecting a button click 1 Answer
How can I generate and setup buttons via code 1 Answer
Get value in button OnClick() 1 Answer
Button.onClick running too many times 0 Answers