Scene view click selects wrong object

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