Immediate Mode: Draw.RectangleBorder invisible while Draw.Rectangle with same parameters shows

Avatar
  • updated

When I try to replace a Draw.Rectangle with Draw.RectangleBorder the latter seems to not show.

This shows:
Draw.Rectangle(
 new Vector3(0,0,0), // pos
 Quaternion.Euler(90, 0, 0), // rotation to face towards y axis

  0.5f, 0.5f, // Width, Height

  Color.magenta // Color
);

This is not visualizing (same parameters as above just adding thickness 0.1f):

Draw.RectangleBorder(
new Vector3(0,0,0), // pos
Quaternion.Euler(90, 0, 0), // rotation to face towards y axis

0.5f, 0.5f, // Width, Height
0.1f, // Thickness

Color.magenta // Color
);


I couldn't figure out why this is and have to assume it is a bug, unless I understand something wrong.
Any help to make rectangle borders work for me, would be much appreciated.

Reporting a bug? please specify Unity version:
2022.1.16f1
Reporting a bug? please specify Shapes version:
4.2.1
Reporting a bug? please specify Render Pipeline:
URP
Avatar
yinon oshrat

It sound similar to an issue I had. 
Test if it does works when you disable GPU instancing in Shapes settings

Avatar
fen

This has started happening to me recently; I'm not sure what could have changed!

I noticed that I could render one border-polygon correctly. But, once the game tried to draw a second polygon, the first one disappeared.

Turning on instancing has mitigated the issue. I'll try reinstalling Shapes, since this might've started after a Library rebuild.

update: yep, a clean reinstall made it go away!

Avatar
Stefan Furcht

Disabling GPU instancing doesn't seem to be a good option, it will likely have a bad impact on overall performance.
I could even work around with faking my own rectangle borders using actual rectangles, but I hope the issue is getting fixed at some pont.

Avatar
Freya Holmér creator

Disabling GPU instancing is a good way to test where the problem is coming from though! if it works when GPU instancing is off, it means you likely have a faulty install/shader cache