Unity Button OnClick() not working with scripts

Hey, apologies if this ends up being something super obvious, but I’m having trouble calling script functions from a button. I know the functions themselves are working because they run if called elsewhere (it works just fine when using a signal emitter on a timeline), and the button works if set to something else (like GameObject.SetActive() or something), but I can’t seem to get anything to happen when trying to call one of my functions from the button.

I made a new script with a function that just does a console log just in case there was something else going on with my other script, but still nothing. Any idea what could be going on here? Thank you!
image.png
image.png

Original Post on Discord

by user 186323452381233153

Hey :wave: that looks correct.

Do you have any errors on export?
Or any during the runime in the browser dev console?

Huh, ok, there was a warning I’d missed - gave me the thought to try changing the ‘T’ in the function name to lowercase, and it works now? :sweat_smile:

(although I’m still getting a similar warning, second image is what I’m getting now even though the button seems to be working)


by user 186323452381233153

Hi glad it works now. How does your script and unity setup look like now? Lowercase letter is definitely correct :slightly_smiling_face:

Just had to update the references on the action to get the warning to go away, everything seems to be working fine now, thanks! :sweat_smile:
image.png

by user 186323452381233153

Ah gotcha :slightly_smiling_face: great!