My solution to not use SerializedField

public class DestroyOnEndAnimation : MonoBehaviour

{

public void DestroyMe()

{

   Destroy(GetComponentInParent<Transform>().gameObject);

}

}

Just make sure this isn’t on a root class in the heirarchy or nested more than one layer below the parent class.

Privacy & Terms