Hi, Unity newbie here. I wrote a script to trigger a callout menu I added to my game. I also added box colliders to both my character and gameobjects for the trigger. Rigidbody is added to the character too. But I still cannot trigger my callout menu. Please help, thanks a lot!
Also, after I added box colliders to the gameobjects, these items still cannot stop my character. If my character bounces on the gameobject, the gameobject will slow my character down, but if I keep pushing, the character will pass the gameobject. How should I solve this problem?
public class EnterCity : MonoBehaviour
{
public GameObject EnterCityMenu;
// Start is called before the first frame update
void Start()
{
EnterCityMenu.SetActive(false);
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Player"))
{
EnterCityMenu.SetActive(true);
}
}
void OnTriggerExit2D(Collider2D other)
{
if (other.CompareTag("Player"))
{
EnterCityMenu.SetActive(false);
}
}
}