Add on click event to canvas button

Given this Scene (see picture).

How do I add an on click event to the Button_Login in the Start() method of the MonoBehaviour class connected to my camera. So that when it is clicked the button the method TryLogin(string username, string password) is called.

I assume I have to get a hold of the button object but I cant find any examples of how to manipulate it as it does not exist in the namespace as Button_Login and I can’t find any way to get the button object.

48265-canvas.png

Assuming you’re using c
From what I understand you’re trying to access your code from a button press. If in your code you have it set up to be public , then you can add the object holding the script, and access that function from the button.48274-capture.png

Just make sure you set it from “void Start” to “public void Start”