Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
3 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
14
Question by Jazzer008 · Apr 01, 2014 at 03:51 AM · gameobjecthierarchydeleteselecthidden

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.

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Lo0NuhtiK · Apr 01, 2014 at 03:58 AM 0
Share

Just to see what happens, click-on/highlight your scene asset in the project panel and hit cntrl+D to duplicate it. Then open that scene and see if the phantom still lurks.

avatar image Jazzer008 · Apr 01, 2014 at 04:14 AM 0
Share

Yep, still there. Same place, no change in hierarchy.

Edit: I made a new scene and copied over my asset, and the ghost was not found. I'd still like to know why it's in my original scene however.

avatar image Bunny83 · Apr 02, 2014 at 02:59 AM 0
Share

@Jazzer008:
Have you tried the editor script i posted in my answer? Have you finally found the object?

2 Replies

· Add your reply
  • Sort: 
avatar image
31
Best Answer

Answer by Bunny83 · Apr 01, 2014 at 04:52 AM

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:

     /Assets/editor/HiddenObjectExplorer.cs

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.

Comment
Add comment · Show 10 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bunny83 · Apr 01, 2014 at 05:08 AM 0
Share

I've updated the script so you can view all objects, not just the top level objects. Note: If you have a lot of objects in the scene it might lag a bit.

avatar image jRocket · Dec 30, 2014 at 03:43 AM 0
Share

Thanks for the script. I had a similar issue where there was an object in my scene, but not in the hierarchy and I couldn't select or do anything with. I used your script and found out that for some inexplicable reason, this object was set to HideInHierarchy. I think there is a bug in Unity that can set this flag.

avatar image Matheuz · Sep 16, 2015 at 10:45 PM 0
Share

Thank you so much, this simple file was extremely helpful.

avatar image jrock84 · Aug 03, 2016 at 09:25 PM 0
Share

Thank you for this script! Genius! I had a corrupt object in my scene and selecting it in the hierarchy caused Unity to consume large amounts of resources but never respond again. This saved me a ton of headache!

avatar image Gru · Sep 29, 2016 at 12:00 PM 0
Share

Thanks, this works great. I used an external tool for something like 3D Notes and when I deleted it all my scenes were reporting missing $$anonymous$$B. Turns out the extension dirtied all scenes with a hidden GO, even those it wasn't used on. After deleting it with this tool, it is required to make another change in the scene (e.g. create empty and delete it) and only then save will work, since otherwise Unity does not mark scene as dirty when you delete the culprit.

Show more comments
avatar image
3

Answer by TheGering · Aug 04, 2016 at 07:17 PM

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() {
         GetWindow<ObjectExplorer>();
     }
 
     readonly List<GameObject> objects = new List<GameObject>();
     Vector2 scrollPos = Vector2.zero;
     bool filterTop = true;
     bool filterHidden = false;
 
     void OnEnable() {
         FindObjects();
     }
 
     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)) {
             objects.Add(obj);
         }
     }
 
     void FindObjects() {
         var objs = Resources.FindObjectsOfTypeAll(typeof(GameObject)) as GameObject[];
         objects.Clear();
         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() {
         GUILayout.BeginHorizontal();
         if (GUILayout.Button("find objects")) FindObjects();
         filterTop = GUILayout.Toggle(filterTop, "only top objects");
         filterHidden = GUILayout.Toggle(filterHidden, "only hidden objects");
         GUILayout.EndHorizontal();
         scrollPos = GUILayout.BeginScrollView(scrollPos);
         for (int i = 0; i < objects.Count; i++) {
             GameObject obj = objects[i];
             if (obj == null) continue;
             GUILayout.BeginHorizontal();
             EditorGUILayout.ObjectField(obj.name, 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();
     }
 }
Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image huulong · Dec 17, 2016 at 01:44 PM 1
Share

Nice variant! I'll use this one in my project then. I put scripts that are useful for any kind of projects in submodules that I share publicly on BitBucket (mainly because it makes it easier for my colleagues to clone projects using these submodules). So you may find this script on this repository https://bitbucket.org/hsandt/unity-commons-editor/src with the appropriate credits (Bunny83 and you) in a few days. Thanks again to both of you!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

42 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Game object deleted from scene but not from hierarchy? 1 Answer

Using Empty GameObjects to organize hierarchy? 2 Answers

Grouping objects without overhead? 1 Answer

Best workflow for DontDestroyOnLoad method regarding Unity Editor? 1 Answer

deleting self-gameobject,deleting self-gameobject 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges