unity destroy only parent code example
Example 1: unity remove parent
transform.parent = null;
Example 2: how to destroy parent gameobject unity
Destroy(transform.parent.gameObject);
transform.parent = null;
Destroy(transform.parent.gameObject);