Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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
1
Question by developer_arni · Jan 10, 2016 at 09:39 PM · editorselectioneditorscripthiddenhideflags

How to force object selection to be the parent of a selected object, when the selected object has HideFlags.HideInHierarchy

The scenario can be minimised to be the following:

I have an empty GameObject which has a child object in the hierarchy. The child object has a SpriteRenderer component attached, as well as an actual sprite such that it is visible in the editor.

This child object has the HideFlag HideInHierarchy meaning that it is still visible in the editor, however not in the hierarchy. This also means that the child object is unselectable in the editor (i.e. when trying to select the child object in the editor, Unity acts as if the child object is not there at all and tries to select whatever is behind the child object, if anything).

I wish to enforce that while the HideInHierarchy flag is active on the child object, the empty GameObject (the parent object) is selected when I try to select the child object in the editor.

Is there any way to achieve this behaviour?

I have tried using SelectionBase on the empty GameObject (the parent object) with no luck.

Any help is appreciated.

Comment
Add comment · Show 2
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 ga5p0d3 · Jun 15, 2018 at 08:18 AM 0
Share

This would be really useful for procedurally assembled composite objects. I want the hierarchy of objects to behave as a single object from the users point of view. Selection of any HideInHierardy child selects the parent so it can be moved/etc.

avatar image Harinezumi · Jun 15, 2018 at 09:41 AM 0
Share

Just a guess, but maybe the UnityEditor.Selection API can help you in this. Specifically, I was thinking of setting UnityEditor.Selection.activeTransform to the object desired to be selected.
Also, this should be in an Editor script, or at least surrounded by #if UNITY_EDITOR / #endif

0 Replies

· Add your reply
  • Sort: 

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

34 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

Related Questions

How can I set a selection-sphere in the editor 1 Answer

Weird bug when dragging object onto EditorGUILayout.ObjectField 0 Answers

Are there any delegate which fires only when a scene has changed in Editor mode, without using ExecuteInEditMode attribute? 0 Answers

Working with the editor Selection 0 Answers

How to get the top most GameObject selected in Editor 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