Button press to get to next scene not working as intended?

So I’ve got my scenes to work from pressing an actual button on the screen with the mouse, but I want the player to be able to click buttons on a keyboard or controller to mvoe onto the next scene.

So far this is on my canvas and works with my button itself, but when I add in the (Input.GetButtonDown(“Jump”)), the jump button doesn’t do anything

public string nextScene;




public void next(){

//if(Input.GetButtonDown("Jump") { 
//Adding in this line above doesn't change to the next scene

SceneManager.LoadScene(nextScene);

   }
}
IEnumeratorChangeLevel(){

//fade between scenes

floatfadeTime=GameObject.Find("Fade").GetComponent<Fading>().BeginFade(1);
yieldreturnnewWaitForSeconds(fadeTime);
Application.LoadLevel(Application.loadedLevel+1);

you’re adding the keyboard button check into the same function that the UI button is set to call?

if so you’d need to press the keyboard key the same frame the button was clicked…

if you want something to keep looking for keyboard input each frame you need to put that into an Update() function, then call the same function the UI button calls.

So put in this above the “next” function?

If so, I put it in the same script and it doesn’t seem to work, is there anything else I’m missing or not doing?

void update () {

if (Input.GetButtonDown ("Jump")) {

SceneManager.LoadScene(nextScene);

}

}