Hello everyone!
I am creating a game in which, at certain moment, I need to make the player ignore certain colliders, for this I have implemented this simple code based on game object tag:
public GameObject player;
GameObject[] allGameObjects;
allGameObjects=GameObject.FindGameObjectsWithTag("tag_GameObjectToIgnore");
foreach (GameObject GameObjectToIgnore in allGameObjects)
Physics2D.IgnoreCollision(player.GetComponent(), GameObjectToIgnore.GetComponent());
Then, after some seconds I need the player to collide again with all those "GameObjectToIgnore". Is there any method to undo the "Physics2D.IgnoreCollision"?
Thanks!
↧