GameObject myObject = new GameObject("New Object");
Transform objectTransform = myObject.GetComponent();
Destroy(myObject);This code destroys the game object myObject. Package library: UnityEngine. In all of the examples, we can see that the GameObject class belongs to the UnityEngine package library.