Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Resolved (URP) Addressable materials/shaders is black (shaders not included or not loading?)

Discussion in 'Addressables' started by FlightOfOne, Sep 25, 2022.

  1. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    659
    Hi,

    I have a main project and content project with addressables. For some reason when I load Addressable content, the materials is pitch black. This happens in the editor and the built versions.

    I tried manually including the shader and the material in the Addressable groups AND even included them in the main project (even though you do not need to do this).

    Looks like either the shaders are not included, or not loading. Is there a way to check this?

    Everything else, meshes, textures, scenes and material itself, seem to load just fine.

    Thanks!

    upload_2022-9-24_18-21-52.png
    upload_2022-9-24_18-22-13.png
    upload_2022-9-24_18-22-38.png
     
  2. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    659
    I tried a simple cube with built in material/shader, same thing. Any ideas? :(

    upload_2022-9-25_7-32-14.png

    If I do this (obviously) it works
    go.GetComponent<Renderer>().material.shader=Shader.Find("Universal Render Pipeline/Lit");
     
    Last edited: Sep 25, 2022
  3. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    659
    So, from further research this only seem top happen with URP shaders only. If I were to make a simple unlit shader and add that to the bundle, that seem to show up ok.
     
  4. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    659
    I could not figure this out, but it turned out it was specific to that project, I created a new project and did not have this problem. If anyone know what may have happened please share.
     
  5. wethings

    wethings

    Joined:
    Aug 26, 2018
    Posts:
    28
    Hey, I have the extact same problem. I've tried building to windows and android.

    With android, for some reason, that dodgy hack with reassigning the shader does not work.

    What I did end up finding out is that if I just added a default cube object with the same shader it made the shaders show up. Which is weird because when I remove the cube the shaders continue to work with the build, until they dont then I have to add the cube back into the scene and it works again, for awhile???

    My scene is completely empty except for the script which handles the spawning of the addressable objects
     
  6. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    659
    Yeah, it is weird, in my case it was a new project and it was mostly empty too. Not even a cube would worw.

    Conclusion I came to was that there may have been something wrong with the addressable files (Unity's). Corrupt file or config maybe. Creating a new project fixed it.
     
  7. pillakirsten

    pillakirsten

    Unity Technologies

    Joined:
    May 22, 2019
    Posts:
    346
  8. JGameMaker92

    JGameMaker92

    Joined:
    Oct 15, 2014
    Posts:
    83
    I'm running into this issue in Unity 2023 with URP also where materials are turning black for some reason. I'm thinking some files got corrupted and I'm not sure how to fix it. Reimport does nothing. Reassigning textures doesn't fix it, nor did changing to a different URP shader

    B63A3E94-2F7B-407B-BB27-DEEE439F1B91.gif


    Edit: Going to file in the file explorer and deleting all associated meta data fixed this for me
     
    Last edited: Aug 19, 2023