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. Dismiss Notice

Question Hybrid Renderer V2 + New Graph Shader error

Discussion in 'Graphics for ECS' started by xotonic, Apr 26, 2021.

  1. xotonic

    xotonic

    Joined:
    Feb 21, 2016
    Posts:
    11
    Unity: Unity 2020.3.4f1 (64-bit)
    Hybrid Renderer: Version 0.11.0-preview.42 - January 22, 2021
    Shader graph: Version 10.4.0 - March 11, 2021
    Universal RP: Version 10.4.0 - March 11, 2021

    I'm getting the error below when I assign any newly created shader from Shader Graph to material to be used by Hybrid Renderer. The mesh is not drawn.
    Code (CSharp):
    1. A Hybrid Renderer V2 batch is using the shader "Shader Graphs/TestShader", but the shader is either not compatible with Hybrid Renderer V2, is missing the DOTS_INSTANCING_ON variant, or there is a problem with the DOTS_INSTANCING_ON variant.
    2. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    However, everything works when I assign the default shader. For example
    Universal Render Pipeline/Unlit


    Do I somehow need to tell Shader Graph that I'm going to use the shader in Hybrid Renderer?

    I create a mesh entity in the code below

    Code (CSharp):
    1.  
    2.             using var ecb = new EntityCommandBuffer(Allocator.Temp);
    3.             var mesh = new Mesh();
    4.             mesh.SetVertices(new[] { Vector3.zero, Vector3.back });
    5.             mesh.SetIndices(new []{ 0, 1}, MeshTopology.Lines, 0);
    6.             var material = Resources.Load<Material>("Materials/Test");    
    7.             var lineEnt = ecb.CreateEntity();
    8.             ecb.AddComponent(lineEnt, new Translation { Value = new float3(0) });
    9.             ecb.AddComponent(lineEnt, new Rotation { Value = quaternion.identity });
    10.             ecb.AddComponent(lineEnt, new Scale { Value = 1f });
    11.             ecb.AddComponent(lineEnt, new LocalToWorld { Value = float4x4.identity });
    12.             var desc = new RenderMeshDescription(mesh, material);
    13.  
    14.             RenderMeshUtility.AddComponents(lineEnt, ecb, desc);
    15.  
    16.             ecb.Playback(em);
    17.  
    Thanks.
     
  2. Kmsxkuse

    Kmsxkuse

    Joined:
    Feb 15, 2019
    Posts:
    297
    I've seen the exact same error but the build of my project is complete unaffected. Try building your project, see if the log has anything special. If it does, you might need to rewrite the shader in HLSL but I seriously doubt it'll be a problem.
     
    xotonic likes this.
  3. OUTTAHERE

    OUTTAHERE

    Joined:
    Sep 23, 2013
    Posts:
    656
    xotonic likes this.
  4. xotonic

    xotonic

    Joined:
    Feb 21, 2016
    Posts:
    11
    Can confirm. After downgrading the error disappeared.

    Voted.

    Thanks.