Search Unity

Bug Public function not showing up in button OnClick() event

Discussion in 'UGUI & TextMesh Pro' started by VeryGoodDeveloperISwear, Apr 8, 2023.

  1. VeryGoodDeveloperISwear

    VeryGoodDeveloperISwear

    Joined:
    Jan 7, 2023
    Posts:
    56
    I have a button and in the OnClick() event I have a gameobject that has the script that I want to attach to the button. When I drag and drop the gameobject, click "No Function", and click on the dropdown with the scripts name, my public void function does not show up.

    Why is this the case? In the same project I have another button, but the public function that I have attached to it shows up in that function dropdown.
     
  2. VeryGoodDeveloperISwear

    VeryGoodDeveloperISwear

    Joined:
    Jan 7, 2023
    Posts:
    56
    I found out why. It is because my function had two parameters which OnClick() events (and in general UnityEvents) cannot use
     
    Last edited: Aug 5, 2023
    jvprawn and unity_OlIMeZmfzyo_RA like this.