Question by
CitrusBoy_ · Feb 11, 2021 at 11:16 PM ·
c#2d2d gametopdown
Is there any way to trigger a popUp UI when a player steps in a specific set of tiles?
I'm making a topDown 2D RPG unity game. I intent to, when a player steps on an invisible set of tiles placed in strategic places, an animation with an UI showing text pops up and makes the player to stop moving. I'm going to show the scripts I have if it helps:
public void PopUp(string text)
{
popUpBox.SetActive(true);
popUpText.text = text;
popupanimation.SetTrigger("pop");
}
This one is the popup system:
private void OnTriggerEnter2D(Collider2D collision)
{
PopUpSystem pop = GameObject.FindGameObjectWithTag("Trigger").GetComponent<PopUpSystem>();
pop.PopUp(popUp);
}
And this one is the trigger script.
I'm new to Unity and C# so I would appreciate if someone could help and explain me like I'm 5.
If you need any more information or context, ask in the comment section.
Comment
Your answer
Follow this Question
Related Questions
KillPlayer, Null Reference Exception. 2 Answers
Z position moving in 2D space 1 Answer
I can't get my spawner to work! pls help fast. 0 Answers
Adding small acceleration to 2d top down movement game? 0 Answers
[Problem] Need help with this! C# 0 Answers