Can't remove GameObject from scene in editor (Not appear in heirarchy, not selectable, Ghost object)

No, this is not an April fools joke.

I was adding capsules to the scene and eventually I noticed this capsule in my scene. It does not appear in hierarchy, I cannot select it in the editor.

You can see in this image the said capsule, and with all objects deactivated in the hierarchy.

alt text

Please help! I’ve tried changing scenes, I’ve tried restarting the client. I would make a new scene but I’d really prefer to know what’s going on here, and how to fix or avoid it in the future.

Well, the capsule might be a normal capsule object but the hideFlags have been set to a combination of HideInHierarchy, HideInInspector and NotEditable. However on a normal capsule you usually don’t see the wireframe of the mesh unless you select it.

It might be just a gizmo / handle of an editorscript.

If it’s a real object you can try this editor script which i just wrote. Just place it in your project’s editor folder:


You can open the window by clicking “Tools/HiddenObjectExplorer”. It might take a few sec. until the Tools menu appears. Just open another menu, that usually makes it visible.

With this window you can view and edit all objects in the scene, even internal objects. Watch out! If you destroy an internal Unity object such as SceneCamera, SceneLight, PreviewCamera, PreRenderLight, HandlesGO and others the editor might fail, crash, spams errors … So watch out what you’re doing.

Thanks for the script, it helped me a lot! Well here is an improved version with top and hidden filter.

using UnityEngine;
using UnityEditor;
using System.Collections.Generic;

public class ObjectExplorer : EditorWindow {

	[MenuItem("Tools/Object Explorer")]
	static void Init() {

	readonly List<GameObject> objects = new List<GameObject>();
	Vector2 scrollPos =;
	bool filterTop = true;
	bool filterHidden = false;

	void OnEnable() {

	void AddObject(GameObject obj) {
		if (filterTop) {
			obj = obj.transform.root.gameObject;
		if (filterHidden) {
			if ((obj.hideFlags & (HideFlags.HideInHierarchy | HideFlags.HideInInspector)) == 0) return;
		if (!objects.Contains(obj)) {

	void FindObjects() {
		var objs = Resources.FindObjectsOfTypeAll(typeof(GameObject)) as GameObject[];
		foreach (var obj in objs) AddObject(obj);
	HideFlags HideFlagsButton(string aTitle, HideFlags aFlags, HideFlags aValue) {
		if (GUILayout.Toggle((aFlags & aValue) > 0, aTitle, "Button")) {
			aFlags |= aValue;
		} else {
			aFlags &= ~aValue;
		return aFlags;

	void OnGUI() {
		if (GUILayout.Button("find objects")) FindObjects();
		filterTop = GUILayout.Toggle(filterTop, "only top objects");
		filterHidden = GUILayout.Toggle(filterHidden, "only hidden objects");
		scrollPos = GUILayout.BeginScrollView(scrollPos);
		for (int i = 0; i < objects.Count; i++) {
			GameObject obj = objects*;*
  •  	if (obj == null) continue;*
  •  	GUILayout.BeginHorizontal();*
  •  	EditorGUILayout.ObjectField(, obj, typeof(GameObject), true);*
  •  	HideFlags flags = obj.hideFlags;*
  •  	flags = HideFlagsButton("HideInHierarchy", flags, HideFlags.HideInHierarchy);*
  •  	flags = HideFlagsButton("HideInInspector", flags, HideFlags.HideInInspector);*
  •  	flags = HideFlagsButton("DontSave", flags, HideFlags.DontSave);*
  •  	flags = HideFlagsButton("NotEditable", flags, HideFlags.NotEditable);*
  •  	obj.hideFlags = flags;*
  •  	GUILayout.Label("" + ((int)flags), GUILayout.Width(20));*
  •  	GUILayout.Space(20);*
  •  	if (GUILayout.Button("DELETE")) {*
  •  		DestroyImmediate(obj);*
  •  		FindObjects();*
  •  		GUIUtility.ExitGUI();*
  •  	}*
  •  	GUILayout.Space(20);*
  •  	GUILayout.EndHorizontal();*
  •  }*
  •  GUILayout.EndScrollView();*
  • }*