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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question Shaders not applying on play mode

Discussion in 'Editor & General Support' started by RicardoCoelhoTTW, Jul 6, 2021.

  1. RicardoCoelhoTTW

    RicardoCoelhoTTW

    Joined:
    Jun 15, 2021
    Posts:
    13
    I'm converting my project to URP, that means some shaders need updating.
    I'm currently having an anoying issue: I have a scene (that is an asset bundle) that has updated shaders and everything works ok when I play this scene.
    However, in a second scene, I load the previous scene as an aditive scene (that means I have 2 scenes simultaneously now), all my shaders are the default pink. And to add to the strangeness, all my objects have the correct shader selected, but if I reapply the shader again, it works.
    What is going on here? Did some references got in the bundle generation? Are there meta files missing?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    29,722
    Pink usually means borked shader, as you know.

    Pink in the asset bundle context often means the bundle was built for one target (eg., iOS or Android) and you are trying to load it in the editor, which won't work. It must be built for Standalone to work in the editor.
     
  3. RicardoCoelhoTTW

    RicardoCoelhoTTW

    Joined:
    Jun 15, 2021
    Posts:
    13
    the shaders were built for Windows, and they work when I play the specific scene. They stop working when the scene is loaded aditively
     
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    29,722
  5. RicardoCoelhoTTW

    RicardoCoelhoTTW

    Joined:
    Jun 15, 2021
    Posts:
    13
    One of the shaders that I'm using that I find hard to believe it will be striped is URP/Simple lit.
    It doesn't seem shader stripping is the problem
    The scene with the objects is an asset bundle, but the materials and shaders are not in that asset.
    Materials and shaders are in the Resources folder, so they shouldn't be stripped (They are in the Resources folder because they are used by multiple asset bundles)
    Some shaders like the previously mentioned URP/Simple lit are built in, so they're probably not stripped
     
    Last edited: Jul 6, 2021
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    29,722
    This assertion runs counter to my experience.
     
  7. RicardoCoelhoTTW

    RicardoCoelhoTTW

    Joined:
    Jun 15, 2021
    Posts:
    13
    Solved. It was damn simple. All I had to do was to Reimport all the project.