Scene view click selects wrong object

My issue is that clicking on an object in the scene view, even in a new project, new scene, with no assets imported, will often select the object behind it. This is also an issue with dragging materials onto objects.

The version of unity in the video is 2017.2.1f1, and I have tried uninstalling and reinstalling unity. I had this problem in the previous version I was using, which I believe was 2017.2.0f3, and I was hopeful to see:

  • Editor: Fixed Scene view picking sometimes not selecting the topmost object. (943051)

in the release notes for 2017.2.1, but upgrading did not change the issue’s behavior at all.

The video below demonstrates the issue, and shows how it may be related to the relative positions of the objects, and the angle of the scene view camera. Not the “Main Camera” in the scene, but the camera we look though in the editor. I made a new project and created two standard materials with black and red color, which I use to show when the issue occurs. When the cube my mouse is over does not turn red, the problem very clear.

As my game world has large scenes with many objects, this is really crippling my ability to make changes, so any help is greatly appreciated.

Yeah, we’re all there. The best is selecting the object in the Hierarchy View and then double click on it to focus on it in the Scene View.

You can also organise your scene objects by putting them on different layers and then masking the unwanted ones: Unity - Manual: Layers

By “we’re all there” do you mean nearly everyone is having this object selection issue? I feel like this forum would be flooded with complaints if that were the case. This bug is actually putting me off Unity completely; it’s unbearable.

As I already explained, you can select the object in the Hierarchy View and double click on it so that the Scene View focuses on it; it’s not like there was no alternative way of doing it.

That’s mostly how I’ve been dealing with it. It’s not that I don’t appreciate your suggestion, I’m just looking for a solution to the problem itself. Thankfully, I believe I have figured out a way to fix it, although I expect it will randomly occur again as it originally did.

I figured that when I reinstalled Unity to see if that works, it probably didn’t delete all Unity related files, since most programs leave something behind. I found that there are “Unity” folders in these places:

C:\Users\UserName\AppData\Local\Unity
C:\Users\UserName\AppData\LocalLow\Unity
C:\Users\UserName\AppData\Roaming\Unity

I uninstalled Unity again, and sure enough those folders were still there. I deleted them and reinstalled Unity, and immediately made a new project. The bug was gone for that new project, but still existed in the old ones. I tried replacing files from the new working project to the old bugged one, and found that if I closed Unity, replaced the CurrentLayout.dwlt file in the Library folder from the bugged project with the one from the new working project, and reopened Unity, the bug was gone. I also deleted the CurrentMaximizeLayout.dwlt that was in the old project, as I had nothing to replace it with from the new one.

I believe that the issue is a somehow bugged CurrentLayout.dwlt (and CurrentMaximizeLayout.dwlt if it’s present) file. Reinstalling Unity did not originally fix the issue, because it seems that when you make a new project Unity just grabs the LastLayout.dwlt file from C:\Users\UserName\AppData\Roaming\Unity\Editor-5.x\Preferences\Layouts, and uses it as the CurrentLayout.dwlt for the new project, and the LastLayout.dwlt file sticks around during a reinstallation.

This means that if your last opened project before uninstalling had the bug in the CurrentLayout.dwlt file, then new projects after a reinstall will be bugged as well. I don’t get how the layout file could cause such a bug, but here we are.

It may be that when some action is performed in the editor, something happens that causes a bug in the CurrentLayout.dwlt file, which ends up in the LastLayout.dwlt file when you close the editor. Once it’s in the LastLayout.dwlt file, new projects will start with a bugged CurrentLayout.dwlt file, making it seem like the problem is with the Unity installation itself.

To fix the issue, you need to reconfigure your layout starting from a non-bugged one such as “Default” from the drop-down in the very top right of the editor, and then save the layout. Doing this will put a non-bugged file with your custom layout in the AppData/…/Layouts folder, and if the issue pops up again you can just reload that layout WITHOUT SAVING IT, and it will be fixed. If the bug occurs and you save the layout, you will have to set up your custom layout from a non-bugged layout file again.

In short: The bug looks like it’s caused by CurrentLayout.dwlt, so when the bug occurs just have a non-bugged layout file to revert to.

This worked for me, and I’m immediately 100 times more productive in the scene view, as my game world is very large and the hierarchy panel is very difficult to search though for that one tree I wanted to click on. Hopefully it works for others experiencing the same issue. This may also help the Unity devs to pin down the source of the issue.

2 Likes

Selecting the Default Layout fixed the problem for me. Much thanks!