Search Unity

[ProGrids Bug] ProGrids breaks camera movement in scene view.

Discussion in 'World Building' started by chatrat12, May 3, 2018.

  1. chatrat12

    chatrat12

    Joined:
    Jan 21, 2015
    Posts:
    122
    Once you install ProGrids via the Package Manager, it instantly hinders camera movement in the scene view. While holding the the right mouse button and using WASD to move around the world, you can no longer strafe the camera right or move backwards.

    Unity Version
    2018.1.0f2
    ProGrids Version 3.0.1 - preview via Package Manager

    Reproduction
    • New project, new scene. Flying the camera with right mouse + WASD works fine.
    • Install ProGrids via Package Manager, restart Unity if ProGrids does not load after installing.
    • Fly camera again, notice the behavior described above.
    I like the idea of packages. Every repo I have has a copy of ProBuilder, ProGrids, TextMeshPro, and the Post Processing stack. I can finally start making some of those repos public since I don't have to share code that's not mine. TextMesh Pro seems to be working just fine in its package iteration. I have not tried the Post Processing stack. ProBuilder and ProGrids are unfortunately having some issues.
     
    Ornate_Owl likes this.
  2. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Dang, that makes two- sorry! Thanks again for the detailed info, ticketed and on the list :)

    Packages are great! According to Karl, it's reduced the build-release time from hours to minutes. Great for making quick fixes ;)
     
    Ornate_Owl likes this.
  3. chatrat12

    chatrat12

    Joined:
    Jan 21, 2015
    Posts:
    122
    Sweet. Are they on the public issue tracker or just tracked internally?
     
  4. Ornate_Owl

    Ornate_Owl

    Joined:
    Oct 4, 2014
    Posts:
    2
    I have the same issue. What was confusing was that those hotkeys were not added to ProGrid's preferences.
     
  5. chatrat12

    chatrat12

    Joined:
    Jan 21, 2015
    Posts:
    122
    Made a quick fix for this one, all in ProGridsEditor.cs. The issue is that the hotkeys for TempDisable and AxisConstrain are marking the KeyDown event as used. To fix it, I check if the right mouse button is down before running the HandleKey code.

    First I added a field to track to if the right mouse button is down.
    Code (CSharp):
    1. const KeyCode k_AxisConstraintKey = KeyCode.S;
    2. const KeyCode k_TempDisableKey = KeyCode.D;
    3. bool m_RightMouseButtonDown = false;  //<--- new line
    Then I created a method to called HandleMouseClicks
    Code (CSharp):
    1. void HandleMouseClicks(Event currentEvent)
    2. {
    3.     if(currentEvent.type == EventType.MouseDown && currentEvent.button == 1)
    4.         m_RightMouseButtonDown = true;
    5.     else if(currentEvent.type == EventType.MouseUp && currentEvent.button == 1)
    6.         m_RightMouseButtonDown = false;
    7. }
    I call HandleMouseClicks right before the HandleKeys method.
    Code (CSharp):
    1. HandleMouseClicks(currentEvent); //<--- new line
    2. HandleKeys(currentEvent);
    Then in the HandleKeys method, I check if the right mouse button is down
    Code (CSharp):
    1. void HandleKeys(Event currentEvent)
    2. {
    3.     // Make sure current event is a keyboard event and that
    4.     // the right mouse button is not down
    5.     if (!currentEvent.isKey || m_RightMouseButtonDown)
    6.         return;
    7.     ...
    8. }
     
    Last edited: May 4, 2018
    FerMelone and gabrielw_unity like this.
  6. SentientSkull

    SentientSkull

    Joined:
    Apr 26, 2013
    Posts:
    75
    Where is 'ProGridsEditor.cs' located? I searched for it and it's not found.
     
  7. chatrat12

    chatrat12

    Joined:
    Jan 21, 2015
    Posts:
    122
    In your Solution explorer in VS, there is a project called Unity.ProGrids.Editor. Alternatively you can press Ctrl + , and type ProGridsEditor. This is all found in Visual Studio, not Unity.

    Edit:
    Put the correct shortcut for 'Go To All', I have a custom one.

    Edit 2:
    If your're looking for it on disk it's in %appdata%\Local\Unity\cache\packages\packages.unity.com\com.unity.progrids@3.0.1-preview\
     
    Last edited: May 6, 2018
  8. militarybeetle

    militarybeetle

    Joined:
    Mar 27, 2019
    Posts:
    10
    DANKS DUDE

    Your fix works like a charm, it's mystifying to me why this post is from almost a year ago and this fix hasn't been implemented into the main code base.

    I'll try to flag the dev down to get this in there
     
  9. FerMelone

    FerMelone

    Joined:
    Apr 10, 2019
    Posts:
    1
    Amazing, this was driving me crazy! Just downloaded 3.0.0 and this was still not there, I cannot live without my right mouse button + wasd. THANKS!