Bullet despawn on leaving view
This commit is contained in:
parent
505715a368
commit
5d4c030d9b
1 changed files with 5 additions and 0 deletions
|
@ -46,4 +46,9 @@ public class Bullet : MonoBehaviour
|
||||||
{
|
{
|
||||||
Destroy(gameObject);
|
Destroy(gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnBecameInvisible()
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue