Zaczynam sobie przygode z unity i nie mam pojecia jak zrobic gdy obiekt nie jest juz w kolizji to zeby przerwał cos.
Gdy zachodzi wyswietla sie menu ale jak juz nie. Chce by automaczynie sie ukrywalo.
void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.name == "Player")
{
if(button != null)
{
bool isActive = button.activeSelf;
button.SetActive(!isActive);
}
}
else
{
//button.SetActive(false);
}
if (other.gameObject.name != "Player")
{
button.SetActive(false);
}
}
Jak to naprostowac ?