Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
3
Question by George · Oct 23, 2010 at 09:51 AM · editorsceneviewgizmosgizmohandles

Select object by selecting gizmo or handle?

Is it possible to select a gameobject by selecting the gizmo in the Scene View? I have a line (Gizmos.DrawLine) between object A and object B and I want to be able to select the line and have it select object A.

That then leads on to my second question to grab a MouseOver event from gizmos, but maybe i'll leave that for another Question.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Tom 17 · Apr 19, 2011 at 01:12 PM

This question is old, so I don't know if I will be of help anymore, still I'm going to answer.

I don't know if gizmos are meant to be selectable, but on the other hand there is the possebility of extending the Unity Editor itself (refer Extending the Editor). There you get the idea of how to use handles to easily modify certain aspects of your object A.

That doesn't help you on your specific question, as basically to see the handles you would have to have your object selected allready. So as another straw for to hold on here is a small editor script that automatically selects the parent of something selected in the scene or hierachy view:

using UnityEditor; using UnityEngine; [@CustomEditor(typeof(AutoSelectParent))] public class AutoSelectParentEditor : Editor { public override void OnInspectorGUI() { EditorGUILayout.TextArea("You should not see this text unless this script doesn't work"); }

 public void OnSceneGUI()
 {
     MonoBehaviour handle = (MonoBehaviour)target;
     GameObject[] selection = new GameObject[1];
     selection[0] = handle.transform.parent.gameObject;
     Selection.objects =  selection;
 }

}

put that script in an Editor folder for it to work. The following script is rather a marker to objects that shall not be selected. Put it outside an Editor folder and attach it to an object. Whenever you try to select object C that is a child of object A, you will instead select A immediatly. This can become a nuisance if you DO want to select object C again. To do that type the name ob object C in the search filter of the scene view to exclude the parent and you CAN select object C again.

using UnityEngine; public class AutoSelectParent : MonoBehaviour { }

Maybe you get some different ideas from the hints I gave you - if you do ponder this problem anymore, anyhow :-)

Comment
Add comment · 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

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

No one has followed this question yet.

Related Questions

Permanent handles (when object is not selected) 1 Answer

What is the best way to fix texture z-fighting? 5 Answers

Editor Windows : Help required 1 Answer

Draggable Nodes in Editor? 1 Answer

Showing Handles in the Game View 1 Answer


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