Search Unity

[ProGrids] Grid rendering broke (all green) in 2018.3

Discussion in 'World Building' started by NemoStein, Nov 5, 2018.

  1. NemoStein

    NemoStein

    Joined:
    Feb 17, 2014
    Posts:
    9
    I've installed ProGrids and used it for some time (couple of hours) without any problems¹, then I decided to change the "Snap Method" preference (Edit -> Preferences -> ProGrids).
    After ticking the checkbox the grid is rendered above the ProGrids controls and scene gizmos and became full green (0x00ff00) with full magenta (0xff00ff) artifacts where grid lines crosses over the ProGrids UI.
    After restarting Unity, the Preferences window display all 3 color pickers in green. Reseting the preferences fixes the pickers, but not the grids. Restarting Unity makes the pickers green again.

    To test this I installed a new Unity version (2018.3.0b8), created a new project and installed the plugin through Package Manager.
    Here is a video showing the whole processes (except installing the Unity version, though you can see the Windows Firewall asking for permissions on the first run):
    My Unity took 2 minutes to open, so, after 30 sec mark you can skip to 2m30


    Reproduced in:
    • All available ProGrids versions (Asset Store 2.5.0, Package Manager 3.0.1~3.0.3)
    • Unity 2018.3.0b7 & b8 (didn't test in older betas)
    • Windows 10
    • Radeon HD 8500M
    • Radeon Software Version: Adrenalin 18.10.1 (driver 18.40.03.01-181017a-334715E-RadeonSoftwareAdrenalin)

    ¹ Aside from reported bug above, sometimes the snapping stop working without any UI changes to indicate that. This is easily fixed by pressing the Ctrl key once.

    Edit: Strangely enough, it worked until I tried to change the settings, but didn't work anymore afterwards, even in a different Unity installation. I assume that Unity Hub shares user preferences between versions and the the bug is related to it.
     
    Last edited: Nov 5, 2018
    hijarian likes this.
  2. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Thanks for the fantastic bug report! :)

    Unfortunately I can't repro this at all yet. Any chance you have a separate computer you can try to repro on?
     
  3. NemoStein

    NemoStein

    Joined:
    Feb 17, 2014
    Posts:
    9
    Well, I couldn't reproduce this on another computer as I don't have one available ATM, and I'm too lazy to create another user or a virtual machine just to try this out.
    But what I could do (and did) was to dig a bit to try and track this down.

    My suspicion was that Unity shared its preferences between installs and I was right.
    According to this manual page the editor preferences is kept at this location in the Windows registry:
    HKEY_CURRENT_USER\Software\Unity Technologies\Unity Editor 5.x

    So, I saved a copy of my current prefs and deleted the whole registry entry, opened Unity and enabled ProGrids.
    And I was right once again, the bug was indeed related to editor preferences and wiping all prefs worked, but of course this wasn't a good solution (I lost all my other settings).
    Then, I exported the working (pristine) registry entry and opened the ProGrids preferences and just pressed the Reset button and nothing else. BOOM!
    Green grids again.
    After exporting the new (broken) registry entry and comparing it to the pristine one I noticed only a handfull of changes, mostly added lines. I assume that ProGrids don't persist any preference if none was changed and just use the defaults.

    Looking carefully through the added ones I found this 3 guys: pg_Editor::gridColorX/Y/Z_somenumber
    After reading the values it was plain obvious what was the problem!

    This is what is saved:
    hex:52,47,42,41,28,30,2c,39,30,30,2c,20,30,2c,34,36,30,2c,20,30,2c,34,36,30,2c,20,30,2c,31,35,30,29,00

    The ASCII representation:
    RGBA(0,900, 0,460, 0,460, 0,150)

    As far as I can tell this are percentages (0..1). I don't know how Unity works internally, but generally RGBA functions receive integers (0..255).
    Even if this is correct (it indeed expects floats and not ints), the main problem here is that I live in Brazil and speak portuguese. My Windows is localized to pt-BR...
    Instead of a period, we use a comma to separate the fractional part of numbers (1,5 instead of 1.5) and the serializer is using the OS number representation to persist the data.

    This explains why you are unable to reproduce the problem. It is linked to OS language.

    I took my original preferences backup and changed the values to floats with periods and to ints form 0 to 255, but none seem to work because as soon as I open Unity this values are replaced by comma punctuated versions (from "0.900" to "900,000" and such). The lines are rendered white in both cases...

    In the end, the most effective way to "solve" the problem was to simply delete these 3 lines from registry and never touch the ProGrids preferences anymore.
    Working so far... ;D
     
    hijarian likes this.
  4. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Wow, that's super work...sorry that you had to do it all yourself! Now that you mention it- I think we had a similar issue with PB recently (comma vs period).

    EDIT: spoke with folks here and this should be fixed internally. Hope to have that fix out soon. Sorry for the trouble!!
     
  5. NemoStein

    NemoStein

    Joined:
    Feb 17, 2014
    Posts:
    9
    Please, don't fell like it!!
    It was super fun to track the culprit and, to be fair, it was easier for me just because I could repro it.

    Looking forward to this fix and PB 4.
    ps: PolyBrush isn't in the PackageManager yet... Will it arrive there?
     
  6. gabrielw_unity

    gabrielw_unity

    Unity Technologies

    Joined:
    Feb 19, 2018
    Posts:
    963
    Good to hear :)

    Polybrush is moving along, no set date yet, really hoping to ensure a super 1.0 version.
     
  7. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,745
    I just want to say that is some fantastic troubleshooting you did there. Bravo!
     
    gabrielw_unity likes this.
  8. MassimoFrancesco

    MassimoFrancesco

    Joined:
    Jul 6, 2019
    Posts:
    44
    Just wanted to note that this error/bug still exists in the current version from Asset Store.

    ProGrid worked perfectly fine, until I changed the snap settings as described by OP.
    Now I have a fully white grid, fixed to Y. Not reacting to color changes anymore.

    Resetting settings in Preferences changes the colors back to the standard ones, but in the Editor nothing changes.
    Tried to delete the ProGrid folder and reimport it into my project, but still, only full white grid.
    Very frustrating.
    I'm not sure how to reset it like OP did, without deleting all my Unity settings.

    Edit: I'm using Unity 2019.1.1f1
     
    Last edited: Jul 6, 2019
  9. MassimoFrancesco

    MassimoFrancesco

    Joined:
    Jul 6, 2019
    Posts:
    44
    OK found the temporary solution.

    Go to the
    HKEY_CURRENT_USER\Software\Unity Technologies\Unity Editor 5.x

    destination as described by NemoStein.

    Unity 2019: You won't find "pg_Editor::gridColorX/Y/Z" but you will find three entries with gridColorX/Y/Z

    Delete all three of them.
    Start Unity again, ProGrid should have its default colors again.
     
    hijarian likes this.