Search Issue Tracker

Won't Fix

Votes

13

Found in

2018.1.0f2

Issue ID

1038686

Regression

No

Graphics.DrawMeshInstanced doesn't draw anything in build

Windows

-

-

Priority: 7Not yet prioritized for a release

-

Severity: 2Core functionality majorly impacted

To reproduce:

1. Open the project, attached by the user (TestInstancing.zip)
2. Open the "SampleScene" scene
3. Enter Play mode
4. Observe that 3 red cubes are drawn
5. Build and run the project for PC standalone
6. Observe that in the build nothing is drawn

Expected: the cubes are drawn in the build as well

Reproduced in 2017.3.2f1, 2017.4.3f1, 2018.1.0f2, 2018.2.0b4, 2018.3.0a1

Reproduced on Windows, Mac and WebGL

Response avatar

Resolution Note:

This happens because shader have instancing support but the material they use (with enabled instancing) is created at runtime, so the "instancing variants" are stripped on build. As a workaround it is enough to create material with this shader and instancing enabled and assign it to some public variable in script. But there might be better workarounds

Comments (9)

  1. B0e8fe43f59c4673ab018ca15e9ef51c?d=mm

    devil_is_god

    Dec 28, 2018 04:03

    I also having the same issue´╝îand i don't know how to fix it! I'm using Unity 2017.4.3.f

  2. 4b619cc364e6f24bf93220f91b4ba107?d=mm

    fnaith

    Oct 01, 2018 08:04

    Solve by attaching materials with our shader to a GameObject, then us:

    GameObject.Find("Shader").GetComponent<Renderer>().materials

    to load shader and copy it to runtime generated material

  3. 4b619cc364e6f24bf93220f91b4ba107?d=mm

    fnaith

    Sep 29, 2018 04:49

    not fixed in Unity-2018.2.10f1

  4. 4b619cc364e6f24bf93220f91b4ba107?d=mm

    fnaith

    Sep 22, 2018 01:13

    Bug still appears in Unity-2018.2.9f1

  5. 4b619cc364e6f24bf93220f91b4ba107?d=mm

    fnaith

    Sep 16, 2018 01:13

    Will this bug also remain us to build standalone regularly...

  6. 385395d9dba674596ca8483be66bfee3?d=mm

    petey123567

    Sep 15, 2018 18:49

    This is affecting our shipping game, any ETA on a fix?

  7. 4b619cc364e6f24bf93220f91b4ba107?d=mm

    fnaith

    Sep 14, 2018 02:47

    Up

  8. 4b619cc364e6f24bf93220f91b4ba107?d=mm

    fnaith

    Sep 12, 2018 08:46

    Dear all, this problem still exist in 2018.2.7f1.

    My scene is more complex but it works with on edit mode:
    https://user-images.githubusercontent.com/11421034/45274388-de043f00-b4e9-11e8-984f-99d289602a74.PNG

    But after building as standalone windows exe. The input still works, but I cannot see anything include ambient light color effect

  9. B670a6db5be3975aba12f5e4f7953883?d=mm

    Dennin-Dalke

    Aug 17, 2018 01:13

    Hey I'm having the same issue, any news on that? On Editor the DrawMeshInstanced is working normally, but on a PC build it never shows up. I'm using Unity 2018.1.8f1

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.