Last active
September 1, 2022 19:06
-
-
Save eduardonunesp/29f4cf474ba14ad6f186efd0fbc6239b to your computer and use it in GitHub Desktop.
Destroy Game Object after animation end
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class ExplosionCenter : MonoBehaviour | |
{ | |
// Use this for initialization | |
void Start() | |
{ | |
Destroy(gameObject, this.GetComponent<Animator>().GetCurrentAnimatorStateInfo(0).length); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for this! It works like a charm, and is much simpler than other potential solutions I have seen.