Search Unity

Bug Running editor tests causes Unity to check all models in the scene for light issues.

Discussion in 'Testing & Automation' started by Baste, Mar 1, 2019.

  1. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    I've got some scenes with a bunch of meshes without normals. If I try to bake lights in these scenes, the light baker will complain that:
    Usually that's fine; I don't use light baking for these scenes. But, when I run tests with the test runner, I suddenly start getting this warning message again.
    When I run tests, I get one warning, for every mesh, for every test. So if I have x meshes with no normals, and y tests, Unity prints this warning message x*y times when I run tests.

    This slows the test runner down to an absolute crawl. If I have all of our scenes open, there's about 600 such meshes. Every unit test takes about 20 seconds to run; a couple of milliseconds for the test, and 20 seconds for Unity to print all of those warning messages to the console.

    So in order to use the test runner, I have to open up an empty scene, run the tests, and then open up the game scenes again.

    This is obviously not good at all. I don't quite know what's going on, but it's probably got to do with how you're handling scenes in the tests.

    To repro, just get a mesh without normals, dump it in a scene, turn off light baking, and run unit tests.
     
  2. ElvisAlistar

    ElvisAlistar

    Unity Technologies

    Joined:
    Oct 2, 2013
    Posts:
    226
    For me, if I simply create a 3D Text game object and I set its Lightmap Static flag to on and try to bake lighting I get that warning message 100 times. So, one issue is that the warning message is very spammy. I will report a bug report about that.

    We will get to the part of how we handle this during test runs, but before that, can you please let me know:
    - which Unity version are you using?
    - are you running Editor or Playmode Tests?
    - is Lightmap Baking turned off or on (maybe provide a screenshot of the settings in your Lighting window)?

    In the meantime, a workaround which I think will help is to select all the objects in your scenes that have these meshes without normals and disable the Lightmap Static flag or all the Static flags on them (if you don't need any): https://docs.unity3d.com/Manual/StaticObjects.html
     
  3. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    - 2018.2.8f1

    - Editor tests

    - Off:
    upload_2019-3-1_14-26-53.png

    The workaround works, but it's not ideal! The warning doesn't say anything about what mesh or what object it's on, so it's not that actionable. I'll have to turn it off on all objects, or do some very painful searching through the scene.

    Also, The lightmap static objects have all of their static flags checked, and there's a lot of them, so I'm going to have to do some editor scripting in order to handle deactivating their flag. It's also very possible that we'll want to start using lightmaps, and at that point getting the flag back would be nice.


    Thanks for the help this far!
     
  4. ElvisAlistar

    ElvisAlistar

    Unity Technologies

    Joined:
    Oct 2, 2013
    Posts:
    226
    In 2019.1 current beta and 2019.2 alpha we don't spam those warnings anymore (looks like the warning might have been completely removed). 2018.3 still has it though, so that's not a good workaround for you at the moment, but just posting this as a small detail.

    I will dig into your actual issue deeper next week and see if we can find a proper solution that doesn't involve quirky workarounds.
     
  5. SGStino

    SGStino

    Joined:
    Jul 8, 2014
    Posts:
    10
    This seems to be still the case and caused by the test running creating a new scene without any light settings,
    and with the default being baked GI enabled... it wants to start baking on every test run.