P
P
Pavel Arutyunov2022-01-20 13:58:08
Mobile development
Pavel Arutyunov, 2022-01-20 13:58:08

How to make an object disappear and appear in Unity2D?

Hello!
Wrote a Script thanks to which the object disappears when the player collides with it:

{
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.tag == "Player")
{
gameObject.SetActive(false);
}
}
}

But I can't get the object to reappear when the "Player" exits the Trigger.
Please help, thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2022-01-20
@GLaWA_RaKoB

So where are youOnTriggerExit2D

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question