New Dashed Line Syntax for Immediate Mode

Avatar
  • updated
  • Answered

I'm really confused how the new dashed line system works after the refactor. I've searched the knowledge base and the documentation, and couldn't find an answer.

How do I do a dashed arc in Immediate mode?

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
Avatar
richard rothkugel
Quote from Freya Holmér

The 4.0.0 changelog has details on this change!

notably, there's helpers so you don't have to construct the entire dash style yourself

var myDashStyle = DashStyle.FixedDashCount( DashType.Basic, count:8 );
var myDashStyle = DashStyle.RelativeDashes( DashType.Basic, size:2f, spacing:1f );
var myDashStyle = DashStyle.MeterDashes( DashType.Basic, size:1f, spacing: 1f );



Nice, thanks.

Avatar
Freya Holmér creator
  • Answered

The 4.0.0 changelog has details on this change!

notably, there's helpers so you don't have to construct the entire dash style yourself

var myDashStyle = DashStyle.FixedDashCount( DashType.Basic, count:8 );
var myDashStyle = DashStyle.RelativeDashes( DashType.Basic, size:2f, spacing:1f );
var myDashStyle = DashStyle.MeterDashes( DashType.Basic, size:1f, spacing: 1f );



Avatar
richard rothkugel

Never mind, figured it out. For future, reference, if anyone is looking for how to do it.

1. Private / Public variables in the main scope

Image 859

2. Assign the dash style in the DrawShapes override.

Image 860

3. In the same scope or related methods / functions, use 'using' with dashedscope and the dashstyle you assigned.

Image 861