Function CommandBuilder.WithDuration
WithDuration
(float duration)
Scope to draw multiple things for a longer period of time.
Public
ScopePersist WithDuration (
float | duration | How long the drawn items should persist in seconds. |
Scope to draw multiple things for a longer period of time.
Normally drawn items will only be rendered for a single frame. Using a persist scope you can make the items be drawn for any amount of time.
void Update () {
using (Draw.WithDuration(1.0f)) {
var offset = Time.time;
Draw.Line(new Vector3(offset, 0, 0), new Vector3(offset, 0, 1));
}
}
Note
Outside of play mode the duration is measured against Unity's Time.realtimeSinceStartup.
Warning
It is recommended not to use this inside a DrawGizmos callback since DrawGizmos is called every frame anyway.