Draw.Line in ImmediateModeShapeDrawer not shown on Android/iOS

Avatar
  • updated
  • Unity's Fault

Hello, Freya, and thanks for the amazing plugin!

I encountered that a straight line drawn with a simple Draw.Line() is showing good in Unity edit/play modes, but is not been drawn on mobile device. I tried either Android and iPhone.

I found a similar post here https://shapes.userecho.com/en/communities/1/topics/192-immediate-mode-drawline-not-appearing-in-standalone-build and as recommended there I turned off GPU instancing for Immediate Mode in Shapes Settings

This workaround works for me (at least I already tested on iPhone).

I still decided to post a message here just to let you know.

My code is pretty simple:

public class DrawController : ImmediateModeShapeDrawer{

...

public override void DrawShapes( Camera cam ) 

{ if( cam != this.cam ) return;
using( Draw.Command( cam ) ) 

Draw.ZTest = CompareFunction.Always

Draw.Matrix = parentTransform.localToWorldMatrix;

Draw.BlendMode = ShapesBlendMode.Transparent

Draw.LineGeometry = LineGeometry.Flat2D;

Draw.Line(new Vector2(-1, 1), new Vector2(-1, -1), 0.05);

...

Reporting a bug? please specify Unity version:
2020.3.5f1
Reporting a bug? please specify Shapes version:
3.2.3
Reporting a bug? please specify Render Pipeline:
Built-in render pipeline
Pinned replies
Avatar
Freya Holmér
  • Answer
  • Unity's Fault

can you try and do a clean reinstall and see if it helps? also, do the platforms you target support GPU instancing?

Avatar
Freya Holmér
  • Answer
  • Unity's Fault

can you try and do a clean reinstall and see if it helps? also, do the platforms you target support GPU instancing?

Avatar
Anton Orlov

Hello,

yes, clean reinstall did help. My iPhone 7 is now able to draw line with GPU Instancing turned on. Thanks!

Avatar
Freya Holmér

ah, glad it worked out!