- Home /
Using KeyCode or get buttonDown for activate collider 2d
So, yoh guys! The issues is that i have two collider for change scene in the same scene (the game is in 2d) , one is activate with "OnTriggerEnter2d", I would like to activate the other by pressing a button but i have no clue to how i could implement it. The base of the script is:
public int index;
public string Level;
void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag ("Player"))
{
SceneManager.LoadScene(2);
}
}
Someone can help me? Thanks in advance!
Answer by Martin_Gonzalez · Mar 26, 2018 at 08:31 PM
You said it.
You can create an UI element called Button and set the callback to one of your scripts.
Are you using Canvas?
Check this video:
no, i didn't use it and even think about it, i'm checking around but i didn't find really helpfull stuff..
YOU are great! Thanks, now i'm less ignorant: once again, thanks :D
Glad it helped, if you want you can set as correct answer for others.