Issue with ALINE in-game draw with duration

  • ALINE version: 1.7.8
  • Unity version: 6.0 LTS
  • Render pipeline: URP

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 I missing here?

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.

Hey!

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.

Thanks!

There was indeed a bug with WithDuration not working on the first frame of the game.

I’ll include a fix in the next update. As a workaround, you can draw it on the second frame of the game.

2 Likes

top notch support, thank you very much and despite the issue I will continue using and recommending your product.

1 Like

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).

1 Like