Search Unity

Unity Editor Freezes on bad shader, somtimes shows blank windows

Discussion in 'Shaders' started by LethalInjection, Jul 7, 2019.

  1. LethalInjection

    LethalInjection

    Joined:
    Jan 25, 2015
    Posts:
    37
    Hi All,
    my unity editor 2018.2.10 was freezing when I selected an object with bad shader code. Sometimes all the unity windows are blank, project, inspector, scene etc and reloading scene or layout will not redraw correctly (probably because the shader is hung).

    here is the bad shader code.
    half _Steps;
    for (int i = 0; i < floor(_Steps-1); i--)
    { ... }

    the bad code was generated from its counterpart and I forget to switch to i++
    for (int i = floor(_Steps); i > 0 ; i--)

    I am mentioning this because, it was not obvious it was the shader code, I also had shadertoy and twitch up and there were also not working.

    I am not sure if the developers can put in protective coding to check for bad loops in the shader compiler.

    I upgraded to 2018.2.23 with the same result. I will test this again when 2019.2 is production ready.

    Thanks,
     
  2. jvo3dc

    jvo3dc

    Joined:
    Oct 11, 2013
    Posts:
    1,520
    Unity doesn't make the shader compiler, so there is not much they can do.