Drawing a line with UITK

I was following the thread here to try and find a way to render a line between 2 points on UITK.
I am doing the following: https://www.toptal.com/developers/hastebin/ativuveces.csharp but for some reason I cannot make it render anything in the game window…

Is there anyone that can see what is going wrong with my code?
Or alternatively, is there a way to render a line in UITK without needing the MeshGenerationContext?

The order of the vertices are important as back facing triangles are culled. I did a small change to the order so that they would be facing the camera to get the following result.

mesh.SetAllIndices(new ushort[ ] { 0, 3, 1, 1, 3, 2 });

7632883--950080--upload_2021-11-5_15-47-59.png

Don’t hesitate to keep us posted of your progress and new questions if you have any.

1 Like

We are working on a basic vector API that would allow doing pretty lines without managing the vertices manually, so the process will be a bit easier in the future, especially if you are aiming to do arcs and more complex shapes.

2 Likes

Ah, thank you! I am trying to make those detective boards that they use to wire up connections and drawing them to a huge overview kinda like this, so a way to draw lines easily would be very nice

Edit: I assume that is planned for a later version of the editor, do you have a timeframe where that vector API may be available?

Always Sunny ruined those for me:

7632901--950083--upload_2021-11-5_13-59-7.jpeg

3 Likes

@SimonDufour I edited my message to ask if you had an estimate on when that vector API would be in the editor (but you probably didn’t see).
Is there some kind of estimate on that or are you not in a position to say as it is still quite early development?

Our plan is to provide the vector drawing api with 2022.x. I will update this post once it lands into a public build.

3 Likes

@uMathieu : I guess the vector drawing API was not yet released? I guess it would be interesting to have something like this, but I can totally understand that implementing this in a totally generic way (i. e. that works even in small edge cases) is not trivial.
Should it arrive, it would still be good to know about it. =)

You might want to take a look at this pinned post Introducing the Vector API in Unity 2022.1

1 Like

Thanks for the hint, I was assuming since the post wasn’t updated that there was no update in the meantime. ^^