Search Unity

Material doesn't have a texture property '_MainTex' error prevents running on HoloLens.

Discussion in 'VR' started by sharkweek42, Sep 22, 2017.

  1. sharkweek42

    sharkweek42

    Joined:
    Jul 30, 2013
    Posts:
    14
    When I build and deploy my app to the HoloLens the splash screen will show up momentarily, then everything turns black. I downloaded the log from the device and saw these errors:


    If I build and deploy to the HoloLens in release instead of debug, the splash screen stays up a little longer, then the app starts but it's incredibly slow and unresponsive. As in it takes 10 seconds or more for the view cursor to start moving after I move my head. I get the second error when I build and deploy in debug on my desktop, but the app runs as normal after I dismiss the error.

    I'm not sure where to go from here. My project contains several shaders that do not have a '_MainTex' property, but none of my code tries to reference that property. The only C#-side reference to a _MainTex in my project is the EditorHands script from the HoloToolkit, but that script isn't even in my scene. I also don't have any UI controls that automatically change things in the UI, like CrossFadeAlpha, so I'm not sure what bit of code could possibly be searching for a '_MainTex' property.

    I've been able to recreate this in Unity 2017.1 with Visual Studio 2015 as well as Unity 2017.1.1 with Visual Studio. These errors do not show up when I build and deploy in Windows Standalone.

    While typing this out I remembered that I have a few materials in my UI, so I disabled that part of the UI and the second warning went away. Then after some googling I discovered that the first app can be caused by various input checks. I recently added touch controls to my app and disabling them in WSA fixed the first warning. It would be nice if there was a platform directive for the HoloLens so I don't have to completely disable something on the entire WSA platform just to keep it from running on the HoloLens. Correct me if such a thing exists, but I don't see it in here: https://docs.unity3d.com/Manual/PlatformDependentCompilation.html

    Anyways, I'm guessing I should file bug reports for these problems since I've sort of figured them out.
     
  2. sharkweek42

    sharkweek42

    Joined:
    Jul 30, 2013
    Posts:
    14
    I started getting a new error after resolving the above error(s).

    I'm even less sure about how to resolve this since the above fix was a random shot in the dark. Any suggestions? This happens in 2017.1 and 2017.1.1. I tried updating to 2017.2 but it broke a lot of HoloToolkit code.
     
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Does this get spammed in your Console? Does it happen only once? Does debugger break at that point?
     
  4. sharkweek42

    sharkweek42

    Joined:
    Jul 30, 2013
    Posts:
    14
    It happens once then the app crashes and the debugger breaks.

    When I run the app on the HoloLens without the debugger attached, the HoloLens becomes unresponsive after it finishes loading past the splash screen. I have to turn it off, then turn it back on. Then when I download the console log from the device it shows the same stacktrace and error only once.
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you post full output from VS output window and a callstack of the crash? We'll likely need a bug report on this.
     
  6. sharkweek42

    sharkweek42

    Joined:
    Jul 30, 2013
    Posts:
    14
    There's not much else in the VS output aside from an error code that I can't find on MSDN:
    Handle Device Removed.
    0x5994DEA8 (UnityPlayer) DllGetActivationFactory
    0x5994DCEE (UnityPlayer) DllGetActivationFactory
    0x59951340 (UnityPlayer) DllGetActivationFactory
    0x5722A3AA (UnityPlayer) DllGetActivationFactory
    0x5722A627 (UnityPlayer) DllGetActivationFactory
    0x58CFD0D2 (UnityPlayer) DllGetActivationFactory
    0x598C8532 (UnityPlayer) DllGetActivationFactory
    0x58DC8FE7 (UnityPlayer) DllGetActivationFactory
    0x568D5913 (UnityPlayer) DllGetActivationFactory
    0x56B4B9D1 (UnityPlayer) DllGetActivationFactory
    0x56B158DF (UnityPlayer) DllGetActivationFactory
    0x56B15A46 (UnityPlayer) DllGetActivationFactory
    0x58A1AA85 (UnityPlayer) DllGetActivationFactory
    0x55ADB6A4 (UnityPlayer) DllGetActivationFactory
    0x55AE6F72 (UnityPlayer) DllGetActivationFactory
    0x55AE7394 (UnityPlayer) DllGetActivationFactory
    0x55B05232 (UnityPlayer) DllGetActivationFactory
    0x69704C6F (threadpoolwinrt)
    0x6970AFF6 (threadpoolwinrt) DllMain
    0x77599B92 (ntdll) RtlDestroyQueryDebugBuffer
    0x77599B52 (ntdll) RtlDestroyQueryDebugBuffer
    (Filename: C:/buildslave/unity/build/Runtime/VR/HoloLens/VRDeviceHoloLens.cpp Line: 491)


    The program '[1880] app.exe' has exited with code -2147483645 (0x80000003).

    I did some testing today and realized I was deploying to the HoloLens with a more complex version of my volumetric rendering shader than I meant to use. The app doesn't crash on load when I switch back to an older, more performant version of the shader. I'm pretty sure the new shader is overwhelming the GPU. Should I still file a bug report? This kind of seems like expected behavior. The new shader was intended for the desktop version of our app.

    I still need to file a bug report for the earlier issue where the app will crash on load when the UI contains a material that doesn't have a _MainTex property.
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    0x80000003 is a failed assert code (also known as "__debugbreak()" or "int 3"). That stacktrace is bogus. You need to get it from the debugger, not the log.