Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Mouse input in scene view doesn't work

Discussion in 'Editor & General Support' started by FNDEBOER, Feb 26, 2024.

  1. FNDEBOER

    FNDEBOER

    Joined:
    Jan 4, 2017
    Posts:
    7
    I have an issue where I can no longer rotate the camera in the scene view with right click or click any objects.

    The orientation lock is off, it's not on 2D mode, I've looked at all my editor scripts and found nothing strange (even went through all of them and disabled them one by one to check).

    Scrolling works to zoom, selecting things in the hierarchy and hitting f to focus works, but clicking anywhere in the scene view doesn't work, except on the transform gizmos.

    I tried disabling a bunch of packages, disabling the input system, fiddled around with settings for hours. I'm at a loss.

    If I make a new project, the issue is gone. I can't migrate this project to a new one as it's far too big for that. I use git for version control, but rolling back a couple of commits it still doesn't work. To be fair, I don't know when this started occurring exactly but I don't want to roll back weeks because of what seems like a scene view bug.

    I tried making a custom editor script that mimicks the rotation and right clicking.It detects the right click, but nothing happens with the scene view camera.

    I'm at a loss here. Anybody got any ideas?
     
  2. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 5, 2024
    Posts:
    533
    Yes.
    - You will need to go back until you find what have you changed to start this behavior. You can only fix the thing if you know what is the thing. And since we don't know nothing about your project, we can't even guess.
    - Scene View bug? How do you know? You don't know what causes it. It may be, may be not. Maybe a bad package you introduced causing it, maybe something you have done triggered a bug in Unity. We don't know until you debug and find out what caused the appearance of this problem.

    You don't have to stay on the code from weeks before, you just need to investigate and find out the cause, then you can come back to your latest and apply changes to avoid the problem. And/or submit a proper bug report.
     
  3. FNDEBOER

    FNDEBOER

    Joined:
    Jan 4, 2017
    Posts:
    7
    Thanks. You're right, of course. So, I rolled back months until I passed a point where I was 100% it wasn't an issue before. Unfortunately, the problem persisted. Apparently my gitignore (standard unity template) didn't cover it, so that narrows it down to a plugin, package, lib, or a bug.

    Curious thing: I can still move the scene view camera with the arrow keys. I just can't right click to rotate (it doesn't show the eye icon with rotation either) or click anything in the scene but a gizmo. An editor script polling the mouse does register mouse1 as clicked, but the scene view doesn't process it.

    Updated to 2022.3.20f, tried a bunch of other installs too. No dice.

    I went as far as deleting every single editor script, resolve all compilation errors and restart. Nothing. Is there a way to diagnose/debug sceneview events?
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,016
    I noticed you didn't call out doing a reimport-all... that's always a thing to try.

    You can also try nuke the
    ProjectSettings/
    folder and replace it with a blank vanill one from a new project, see if it fixes it, then revert it with git if it didn't.
     
  5. FNDEBOER

    FNDEBOER

    Joined:
    Jan 4, 2017
    Posts:
    7
    Thanks. I did a reimport. Nuking projectsettings and replacing it with the one from a fresh project seemed like a good idea. Didn't work.

    I updated to 2023 out of desparation and now when I right click in the scene view, I get a context menu like so: upload_2024-2-28_14-27-31.png

    When I hover over the menu items I can see them highlighted, but clicking on any of the menu items does nothing.

    So, something in my project is keeping something nonexistent in the scene view actively selected for some reason. I can't see what that might be in the inspector or the hierarchy.
     
  6. Igrom-Ung

    Igrom-Ung

    Joined:
    Aug 12, 2019
    Posts:
    2
    Today spontaneously I got the same problem, Unity version 2022.3.14f1
     
    cybermynd likes this.
  7. Igrom-Ung

    Igrom-Ung

    Joined:
    Aug 12, 2019
    Posts:
    2
    I have everything working fine in the new project.... I can assume that the problem is inside the current project.
     
  8. FNDEBOER

    FNDEBOER

    Joined:
    Jan 4, 2017
    Posts:
    7
    I'm migrating everything to a new project. It's tedious and time consuming but I haven't found any other solutions.
     
  9. FNDEBOER

    FNDEBOER

    Joined:
    Jan 4, 2017
    Posts:
    7
    For anyone dealing with this: I figured it out. This code was the culprit:

    EditorApplication.delayCall = () => { EditorApplication.delayCall = () => { FORCE_INIT = false; }; };

    Bug introduced in f14 that breaks how this works.
     
    RokasVysnia and Uidoma like this.
  10. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    80
    I'm experiencing the same problem... :/ Where did you find that culprit code line...? Looking through my 3rd party editor scripts, but don't find anything like that yet
     
  11. Raveler

    Raveler

    Joined:
    Sep 24, 2012
    Posts:
    42
    Wow. I've been searching for a day to find out what is going on. How on earth did you find the culprit? I never would've found that. That's bonkers.

    The problem for me (the exact same line by the way) was in ReorderableArrayInspector, a small library used for allowing reorderable arrays in the inspector.
     
  12. Raveler

    Raveler

    Joined:
    Sep 24, 2012
    Posts:
    42
    For the record: I figured out what the problem was. This is a delegate called when all inspectors have been reloaded, and this plugin just overrides all subscribed callbacks in delayCall and sets it to itself. Apparently, a new version of Unity subscribes to this callback and uses it for crucial functionality in the scene view.

    So I wouldn't call this a bug; rather a plugin that was written really badly.

    Change it to this line to fix it:

    Code (CSharp):
    1. EditorApplication.delayCall += () => { EditorApplication.delayCall += () => { FORCE_INIT = false; }; };
    This will still subscribe to the callback but not delete any others subscribed to it.
     
    Last edited: Apr 26, 2024
    florianveltman likes this.
  13. florianveltman

    florianveltman

    Joined:
    Sep 7, 2012
    Posts:
    28
    @Raveler thank you for figuring out what was going on, I ran into this exact problem with this exact library. What a relief to come across your post! The suggested code change has fixed the issue for me.