Android device not support GPU instancing. Immediate mode Using Draw.Command throw error

  • updated
  • Under Review

I was expecting the GPU instancing Draw command will still draw something if device not support instancing.

It did not draw anything and only an error was throw on Android device say instancing is not supported on this device.

So I have to manually check if device support instancing or not.

using (Draw.Command(cam))
else Drawing();

I suggest the package add some documents so other people can avoid it.

Or better Draw.Command() handle non gpu-instancing device internally.

Note: this also happen to some specific newer devices. Not old android Android.

I do not have specific data but you could expect around 10% users on country like Brazil have good android Device but still not support GPU instancing.

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Freya Holmér
  • Under Review

I'm not sure if this is something I should error handle on my end, I feel like this is a bit of a borderline case. I'll think about it!

Thomas Brown

Just wanted to follow up this thread with a bit more detail as I thought it might be helpful :). It also appears to be happening on my end as well, although this could be a separate issue altogether. Additional Unity context here.

I'll go ahead and implement the solution above in the meantime. I would also be happy to provide more info if necessary.

Thomas Brown

After taking a stab at solving this my own way, I came up with this solution. Just in case anyone else stumbles upon this thread and has the same issue.

I add the below code to my GameStartState which is some of the first code that executes in my game.

//disable shapes gpu instancing mode if platform doesn't support it
ShapesConfig.Instance.useImmediateModeInstancing = SystemInfo.supportsInstancing;

Because ShapesConfig is a ScriptableObject I add the !UNITY_EDITOR preprocessor directive to ensure it doesn't keep getting changed and show up in my version control.