I am new to C# and been trying to make a 2D platformer game by learning specifically what I need. I am kinda stuck atm.
I have tagged the Door with "Next" and programmed the player to enter "level 2" scene when it collides with anything tagged with "Next".
I want the player to obtain a Key before this script can take effect, and i have no idea how to code it.
I know this isn't the most optimal code, but this is what I used to make the game load next level
private void OnTriggerEnter2D(Collider2D other)
if (other.gameObject.CompareTag("Next"))
{ SceneManager.LoadScene("Level 2");}
Help will be much appreciated.