Hello I am trying to use ALINE to debug a grid in-game and editor view.
for (var x = 0; x < _width; x++)
{
for (var y = 0; y < _height; y++)
{
Draw.ingame.DashedLine(GetWorldPosition(x, y), GetWorldPosition(x, y + 1), 1, 1);
}
}
This shows the line for about a frame when game first plays. Okay no problem I will use withduration, right?
for (var x = 0; x < _width; x++)
{
for (var y = 0; y < _height; y++)
{
using (Draw.ingame.WithDuration(20))
{
Draw.ingame.DashedLine(GetWorldPosition(x, y), GetWorldPosition(x, y + 1), 1, 1);
}
}
}
Now nothing shows up at all. Not even for a single frame. Okay, maybe weird issue with loop and using. Let me put using outside of loop.
using (Draw.ingame.WithDuration(20))
{
for (var x = 0; x < _width; x++)
{
for (var y = 0; y < _height; y++)
{
Draw.ingame.DashedLine(GetWorldPosition(x, y), GetWorldPosition(x, y + 1), 1, 1);
}
}
}
Still nothing. Empty. Completely, nothing. It canāt be an issue with my position or size or anything else because when I remove the withduration it shows up for a frame in the expected place. I just canāt make it stay there.
What method are you calling these in? I assume Update(), especially if youāre using it in-game (and probably tagging it to run in editor for using it during edit mode)ā but I donāt want to make any strong assumptions.
Iām calling them in the constructor of a pure C# class; as it can be gleaned from the code, I wanted to use ALINE to draw a grid in the world. The actual reference to the grid object is being created on a Monobehaviour class.
Trying it out for myself (just trying to get it in a non-Update Loop) but Iāll have to call in the big guns for this one; need to ask Aron about this. Iām relatively new to ALINE and only just started being able to help with ALINE questions and Iāve never tried something like this myself. I can get it to draw for 2 seconds in Update(), but also not on the first frame. Iāll tag him on this though for clarity.
Sorry for necroing this but I have the same problem (drawing is not working at runtime).
Unity 6000.0.62f1
ALINE 1.7.8
URP
Code is being called from Update() but not in the first frame of the game. It does not matter when I call this code. It never draws for the given duration during runtime if the āDraw.ingameā scope is used.
Here is the code I use:
// Works as expected (draws for 10 sec)
using (Draw.WithDuration(10f))
{
Draw.WireSphere(intersectionPoint, 0.5f, Color.red);
}
// Draws for 1 frame only š
using (Draw.WithDuration(10f))
{
Draw.ingame.WireSphere(intersectionPoint, 0.5f, Color.red);
}
A fix would be nice. It seems v 1.7.8 is about half a year old. Any ETA on this fix?
UPDATE: My bad. I should have used Draw.ingame.WithDuration(10f) not Draw.WithDuration(10f).