Button not calling 'a calling function'

I encountered a problem, i added a button to the game which on click would call a function to transition to next scene. But the function wouldn’t work though it worked when I called it using a script

public void Transit()
    {
        transit.SetTrigger("transit");
        Invoke("next",0.833f);// wait for transition to complete
    }

    public void next()
    {
        //next scene
    }

Thank You

Hi, I think the reason your code didn’t work is because you didn’t call it correctly.
Please bring the script into scene and select from object correctly.
For example, GameOject include the script file named - “my transit” and select that object and , in that , select function named -Transit().

Yes it’s done correctly but still it isn’t working
image
maybe its something with public or private declaration?