Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

A Hybrid Renderer V2 batch is using a pass from the shader "Legacy Shaders/Particles/Additive", whic

Discussion in 'Graphics for ECS' started by goodnewsjimdotcom, Feb 17, 2022.

  1. goodnewsjimdotcom

    goodnewsjimdotcom

    Joined:
    May 24, 2017
    Posts:
    342
    A Hybrid Renderer V2 batch is using a pass from the shader "Legacy Shaders/Particles/Additive", which is not SRP batcher compatible. Only SRP batcher compatible passes are supported with the Hybrid Renderer.

    Problem:

    I have dozens of shaders from asset store things.
    I don't need it, but I can't find the offender to delete.
    I am not good with shaders or searching for "Legacy Shaders"

    If I delete it, it fixes this, right? But how do I find it?

    And is the V2 renderer working at all if this error happens?

    TY!

    ,Jim
     
  2. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    Changing the shader on the Material that uses it, or changing the Material on the affected the objects should cause this error to not happen.

    If the error happens, it might slow down performance for generating the error message, but correctly set up entities should still render, only batches with the erroneous shader are skipped.
     
  3. goodnewsjimdotcom

    goodnewsjimdotcom

    Joined:
    May 24, 2017
    Posts:
    342
    Thank you, I reasoned that. Thank you for confirming.

    How do I find that shader? I have hundreds, and I can't search for it. It isn't named legacy.
     
  4. joelv

    joelv

    Unity Technologies

    Joined:
    Mar 20, 2015
    Posts:
    203
    This is a builtin legacy shader in Unity (unless you have copied it to your own project). You probably need to find an URP/HDRP alternative.
     
  5. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    It sounds possible that the shader in question is a built-in Unity shader (I am just guessing here based on the shader name), in which case it would be better to change the Material that uses the shader to use some other shader instead.
     
  6. goodnewsjimdotcom

    goodnewsjimdotcom

    Joined:
    May 24, 2017
    Posts:
    342
    How do I find it? This has been bugging me for over a week, even crashing my system, reverting it to weird unstable states, wasting days of time.


    A Hybrid Renderer V2 batch is using a pass from the shader "Legacy Shaders/Particles/Additive", which is not SRP batcher compatible. Only SRP batcher compatible passes are supported with the Hybrid Renderer.
    0x00007ff7dc898bdc (Unity) StackWalker::GetCurrentCallstack
    0x00007ff7dc89ffd9 (Unity) StackWalker::ShowCallstack
    0x00007ff7dd5fcd9c (Unity) GetStacktrace
    0x00007ff7de045e83 (Unity) DebugStringToFile
    0x00007ff7dc648b55 (Unity) LogRepeatingStringWithFlags
    0x00007ff7dc48bec1 (Unity) PrepareScriptableLoopObjectData
    0x00007ff7dc48b1e5 (Unity) PrepareScriptableDrawRenderersJob
    0x00007ff7dc4b1c2b (Unity) JobQueue::Exec
    0x00007ff7dc4b3882 (Unity) JobQueue::Steal
    0x00007ff7dc4b1fd0 (Unity) JobQueue::ExecuteJobFromQueue
    0x00007ff7dc4b243b (Unity) JobQueue::processJobs
    0x00007ff7dc4b426f (Unity) JobQueue::WorkLoop
    0x00007ff7dc67f105 (Unity) Thread::RunThreadWrapper
    0x00007ff882497034 (KERNEL32) BaseThreadInitThunk
    0x00007ff882ba2651 (ntdll) RtlUserThreadStart


    -----


    Guys, I tried upgrayedding to Hybrid Renderer V2.

    Got this message: A Hybrid Renderer V2 batch is using a pass from the shader "Legacy Shaders/Particles/Additive", which is not SRP batcher compatible. Only SRP batcher compatible passes are supported with the Hybrid Renderer.

    Problem:

    I have dozens of shaders from asset store things. I don't need it, but I can't find the offender to delete. I am not good with shaders or searching for "Legacy Shaders"

    If I delete it, it fixes this, right? But how do I find it?

    And is the V2 renderer working at all if this error happens?

    TY!

    ,Jim
     
  7. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    I'm not sure if there's an easier way, but one way would be to write a one-off debugging script that checks the shader of every material of every GameObject in your scene, and compares the name against that string.
     
  8. goodnewsjimdotcom

    goodnewsjimdotcom

    Joined:
    May 24, 2017
    Posts:
    342
    >I'm not sure if there's an easier way, but one way would be to write a one-off debugging script that checks the shader of every material of every GameObject in your scene, and compares the name against that string.

    This is way too difficult. Shaders are known as a difficult hidden arcane art that not everyone knows. HDRP is new technology too amplifying the difficulty. The Unity Editor should have some way of searching this in my project by default. You're saying there is no way to actually find the prefab with the offending shader with Unity search. That's so weird.... Well it explains why I couldn't find "legacy" anywhere in unity search. Why couldn't I find the word "legacy" in my project when I searched via windows? Maybe it's written in binary??? This is so weird...
     
    Last edited: Feb 25, 2022
  9. goodnewsjimdotcom

    goodnewsjimdotcom

    Joined:
    May 24, 2017
    Posts:
    342
    I'm still getting this error over a year later.

    How can I tell what shaders of mine are legacy? My project is 60 GB in size now, growing to 10 TB once I get rolling.

    I thought I was releasing a the MMORPG I dreamed of for 40 years today, but it crashes standalone, but not in editor...
     
  10. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    The shader "Legacy Shaders/Particles/Additive" could be a Unity built-in shader from the built-in render pipeline, and you have some asset that is using it.

    You could try to find the asset in question by running a script like this:
    Code (CSharp):
    1.             foreach (var o in UnityEngine.Object.FindObjectsOfType(typeof(GameObject)))
    2.             {
    3.                 var go = o as GameObject;
    4.                 var r = go.GetComponent<MeshRenderer>();
    5.                 if (r != null)
    6.                 {
    7.                     foreach (var m in r.sharedMaterials)
    8.                     {
    9.                         var s = m.shader;
    10.                         var shaderName = s.name;
    11.                         if (shaderName.Contains("Legacy"))
    12.                             Debug.Log($"go: {go} m: {m} s: {s}");
    13.                     }
    14.                 }
    15.             }
    16.  
     
    apkdev likes this.
  11. goodnewsjimdotcom

    goodnewsjimdotcom

    Joined:
    May 24, 2017
    Posts:
    342
    I put your code in my editor scripts, had an error:

    it was on the line: var s = m.shader;

    NullReferenceException: Object reference not set to an instance of an object
    GlobalKeyEvents.OnGlobalKeyPressed () (at Assets/Editor/GoodNewsJimCompileSpeeder.cs:85)
    UnityEditor.EditorApplication.Internal_CallGlobalEventHandler () (at <1f0be198f5164d2489de92f22c998266>:0)




    Code (CSharp):
    1. case KeyCode.F10:
    2.                     {
    3.  
    4.  
    5.                         foreach (var o in UnityEngine.Object.FindObjectsOfType(typeof(GameObject)))
    6.                         {
    7.                             var go = o as GameObject;
    8.                             var r = go.GetComponent<MeshRenderer>();
    9.                             if (r != null)
    10.                             {
    11.                                 foreach (var m in r.sharedMaterials)
    12.                                 {
    13.                                     var s = m.shader;
    14.                                     var shaderName = s.name;
    15.                                     if (shaderName.Contains("Legacy"))
    16.                                         Debug.Log($"go: {go} m: {m} s: {s}");
    17.                                 }
    18.                             }
    19.                         }
    20.                     }
    21.                     break;
     
  12. goodnewsjimdotcom

    goodnewsjimdotcom

    Joined:
    May 24, 2017
    Posts:
    342
    Could we add to the script by forcing it to convert to HDRP/Unlit?
     
  13. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    You probably want an extra null check in there, so skip the loop body if m is null.
     
  14. goodnewsjimdotcom

    goodnewsjimdotcom

    Joined:
    May 24, 2017
    Posts:
    342
    Much obliged, I'm still new to editor scripting, seems powerful tho, maybe fix some issues Unity doesn't have, like right here, Unity should have the ability to naturally find all resources that contain this.


    Okay on execution the script does nothing apparently.