Check for empty gameobject in script?

Is there a way to check in a script if a gameobject is empty?

Checking for all documented components would not asure there is no custom script…

Any ideas?

Thanks

G

You could probably use GameObject.GetComponentsInChildren or GameObject.GetComponents and check if there are any other components than Transform.

var components = targetGameObject.GetComponents<Component>();
// check components...