Search Unity

Setting _MainTex_ST property in MaterialPropertyBlock disables GPU instancing

Discussion in 'Shaders' started by Micz84, May 16, 2019.

  1. Micz84

    Micz84

    Joined:
    Jul 21, 2012
    Posts:
    451
    When I am setting _MainTex_ST using material property block and it causes meshes not to be rendered with GPU instancing what can cause such behaviour? I am setting only x and y values z and w are set to 0.
    example values:
    (1.1, 1.1, 0.0, 0.0)
    (1.8, 1.1, 0.0, 0.0)
    (6.1, 16.4, 0.0, 0.0)

    Code (CSharp):
    1.  
    2. meshRenderer.GetPropertyBlock(result.SegmentPropBlock);
    3. result.SegmentPropBlock.SetVector(Shader.PropertyToID("_MainTex_ST"), st);
    4. meshRenderer.SetPropertyBlock(result.SegmentPropBlock);
    5.