Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Vel_1828 · Nov 22, 2016 at 07:58 PM · selectionscene view

Scene View - Click selects wrong object?!

I am facing a very frustrating bug for a very long time. Sometimes (45% of times), when there are a few objects (like cubes etc.) layered on top of each other (like Enviro meshes, and terrain), mouse-clicking on anythng wil select not the thing I am pointing at, but instead it selects the "lowest" or "largest" object the click "penetrated".

Example: Imagine a cube on a Unity Terrain. if I look from up and click on the cube, in 45% of cases not the cube will be selected, but the terrain underneath it. To select the cube I will have to awkwardly position my camera in a way that nothing is behing the click-line but the cube.

How do I fight this issue? It's destroying my nerves. ;/

Comment
Add comment · Show 4
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 Vel_1828 · Nov 26, 2016 at 09:18 PM 0
Share

no one really? :(

avatar image Nova-1504 · Nov 27, 2016 at 12:45 AM 0
Share

Why don't you just select it in the hierarchy? I have lots of sprites close together in my game and I just select things in the hierarchy. You don't even have to be looking at the GameObject in scene view.

avatar image Denisowator · Nov 27, 2016 at 01:03 AM 0
Share

First off, report it as a bug. No one in the community can help you, other than the developers of Unity, who actually have access to its source code.

Secondly, in reply to Nova-1504: That would work for some projects, but if someone (like myself) had, let's say 1500+ objects in their scene. It would be quite literally impossible to do it your way, unless the person had a chip in their brain, that helped them remember exactly which object in the hierarchy refers to which object in the scene view.

avatar image Nova-1504 · Nov 27, 2016 at 01:04 AM 1
Share

Sorry, didn't think of that.

4 Replies

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

Answer by Bunny83 · Nov 27, 2016 at 01:41 AM

I'm not sure what's you actual problem- The fact that when you click multiple times at the same point, Unity cycles through all objects that intersect the "ray" of the mouse pointer. That's actually a feature and in many cases very useful.

However there are ways to prevent certain interaction. You can use layers to either prevent selection or hide the objects of the layer completely in the editor. The editor has a "Layers" dropdown at the very top right which controls which layers are visible and which are selectable.

While locking a layer usually works just fine, there seems to be one exception: Terrains. Locking the layer of a terrain object doesn't seem to prevent selecting it. However you can still simply hide the layer so the terrain isn't visible anymore. It's also possible to simply deactivate the terrain temporarily. Though in most cases, if the top most object is already selected and you click again so it selects the next lower object, simply continue clicking until your desirec object is selected again. How many object so you have on top of each other?

So again, the behaviour of the SceneView is deterministic and i never had any problems with it. What might confuses a bit is that an object selection can have two different "selected states". It generally works like this:

  • If nothing is currently selected, when you click the top most object as seen from the camera is selected. So that object you have your mouse on. That object will get the "selected" state as well as the "hot" state (i just made up that term).

  • if an object is currently selected and has the hot state, when you click directly on another object, that object will be selected and receives the hot state, just like in the first case.

  • However when you click on a hot and selected object again the selection goes to the next lower object that the mouse ray hits. Note that the hot state stays at the top most object. Each time you click again on the hot object the selection goes one step down to the next object until the last is reached where it will select the top most again.

  • When you indirectly selected an object by clicking the hot object twice so the second lowest object is selected (the top one is still hot), then you now directly click on the currently selected object it sill stay selected and will become hot. Every further click will again propergate the selection further down.

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
avatar image
-1

Answer by UDN_077a3309-c352-4d18-bd5c-0ba0c6873aef · Nov 27, 2016 at 03:01 PM

Maybe you can get around it using a LayerMask on the raycast(), put the cube on that specific layer.

 int CubeLayerMask = 1 << 9; 

Where 9 would be the layer number for your cube passed into the Raycast layermask parameter.

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
avatar image
0

Answer by gaberg21 · Nov 27, 2016 at 08:45 AM

Have you tried layers? Maybe mess around with that.

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
avatar image
0

Answer by LieutenantKraken · Nov 27, 2016 at 02:57 PM

You could try different things. Regarding lack of some information on your situation, i would choose these solutions:

  • Use 'Physics.RaycastAll' to get an array of all colliders which got hit by the ray

  • Visualize the Ray by using 'Debug.DrawLine' or 'Debug.DrawRay' and then pause the game with 'Debug.Break'

  • Use Layers for the terrain and object you are trying to select

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 Bunny83 · Nov 28, 2016 at 05:09 AM 0
Share

Uhm you have realised he talks about working inside the Unity editor. In the SceneView. The question even has the tag "sceneview" ^^.

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

62 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 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

Can't Select GameObjects Under UI In Scene View 5 Answers

Access Scene View Selection Rectangle 0 Answers

Selecting custom game objects in Scene view window. 1 Answer

How can I get info on object in scene view without selecting it? 0 Answers

Loss of GO selection 2 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