Newbie Q - how do I set dash parameters?

Avatar
  • updated
  • Answered


Can you give an example of how to set and apply the dash parameters (space, size, etc.) programmatically for ArcDashed?

I have found the DashStyle class but don't know how to apply it....I am missing the right level of assumed knowledge :)

Reporting a bug? please specify Unity version:
Reporting a bug? please specify Shapes version:
Reporting a bug? please specify Render Pipeline:
URP
Pinned replies
Avatar
Freya Holmér
  • Answer
  • Answered

I recently refactored how all of this worked so, uh, I actually don't fully remember~ *goes to check*

So arcs (and rings) default to using the static Draw.RingDashStyle property, so you can assign to or edit that, and then call

Draw.ArcDashed( pos, rot );

and it will use the dash style you supplied.
Note however that this is changing in the upcoming version - there will no longer be a separate dash style for arcs and lines, there will only be one field for that :)

Avatar
Freya Holmér
  • Answer
  • Answered

I recently refactored how all of this worked so, uh, I actually don't fully remember~ *goes to check*

So arcs (and rings) default to using the static Draw.RingDashStyle property, so you can assign to or edit that, and then call

Draw.ArcDashed( pos, rot );

and it will use the dash style you supplied.
Note however that this is changing in the upcoming version - there will no longer be a separate dash style for arcs and lines, there will only be one field for that :)

Avatar
Andrew Styan

So, like this:

DashStyle arcDashStyle = new DashStyle(); 
arcDashStyle.space = DashSpace.Meters; 
arcDashStyle.size = 0.01f; 
arcDashStyle.spacing = 0.01f; Draw.RingDashStyle = arcDashStyle;

That works! It was the last line I couldn't get.

And the future version will be:

Draw.DashStyle = arcDashStyle;

Loving this asset more and more as I figure out how to use it :)

Thanks Freya.

Avatar
Freya Holmér

exactly like that yes! also I'm glad you like it <3