Skip to content

Instantly share code, notes, and snippets.



Created Oct 8, 2015
What would you like to do?
void ClearField()
GameObject[] targets = GameObject.FindGameObjectsWithTag("Target");
foreach (GameObject target in targets)
public void Exit()
if (this.GetComponent<Animator>() == null)
// no Animator so just destroy right away
else if (!startDestroy)
// set startDestroy to true so this code will not run a second time
startDestroy = true;
// trigger the Animator to make the "Exit" transition
// Call KillTarget function after exitAnimationSeconds to give time for animation to play
Invoke("KillTarget", exitAnimationSeconds);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.