# How can I draw multiple lines in UMG

**URL:** <https://forums.unrealengine.com/t/how-can-i-draw-multiple-lines-in-umg/473093>\
**Category:** UI\
**Tags:** unreal-engine, question, UMG\
**Created:** [October 18, 2020, 3:07am UTC](https://forums.unrealengine.com/t/how-can-i-draw-multiple-lines-in-umg/473093 "2020-10-18T03:07:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ethidium](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ethidium](https://forums.unrealengine.com/u/Ethidium)\
**Post date:** [October 18, 2020, 3:07am UTC](https://forums.unrealengine.com/t/how-can-i-draw-multiple-lines-in-umg/473093/1 "2020-10-18T03:07:07Z")

</div>

I’m trying to use the OnPaint override and Draw Line in a blueprint to draw a compass plot, with many lines coming from a single origin. The number of lines needed is not fixed. How can I do this?

- I can’t loop through the Draw Line function because OnPaint reinitiates every tick and only the first line is drawn.
- DrawLines draws a polyline of sequentially connected segments, rather than all segments radiating from a common origin

Thanks

---

<div class="post-metadata">

**Author:** ![Ethidium](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ethidium](https://forums.unrealengine.com/u/Ethidium)\
**Post date:** [October 18, 2020, 3:27am UTC](https://forums.unrealengine.com/t/how-can-i-draw-multiple-lines-in-umg/473093/2 "2020-10-18T03:27:18Z")

</div>

Never mind - I just had the return node inside the loop. This works:

 ![319079-loopeddrawlines.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/9/8/698af5f117ef010d20b7f48a84087266eb35c45d.jpeg)

---

<div class="post-metadata">

**Author:** ![ilike9527](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ilike9527](https://forums.unrealengine.com/u/ilike9527)\
**Post date:** [March 11, 2022, 11:56am UTC](https://forums.unrealengine.com/t/how-can-i-draw-multiple-lines-in-umg/473093/3 "2022-03-11T11:56:24Z")

</div>

Unreal default “DrawLine” api has inconvenient points for developers:

- Lines can not be previewed and edited in UMG editor.
- Hard to edit complex lines.
- Can not draw splines.
- Can not set a brush for the line geometry.
- Can not be used as a rail for other widgets.

Maybe you can try the “UMGSpline” plugin to solve your problems:  
[UMGSpline in Code Plugins - UE Marketplace](https://www.unrealengine.com/marketplace/en-US/product/umgspline)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 11, 2022, 12:09pm UTC](https://forums.unrealengine.com/t/how-can-i-draw-multiple-lines-in-umg/473093/4 "2022-03-11T12:09:53Z")

</div>

> [@ilike9527](#):
>
> - Lines can not be previewed and edited in UMG editor.

> [@ilike9527](#):
>
> - Can not be used as a rail for other widgets.

Not really true:

> [@Draw a Line between two widgets](https://forums.unrealengine.com/t/draw-a-line-between-two-widgets/485568/2):
>
> Ensure the Skill Icons are parented to a Canvas so you can get their positions: The parent widget can draw lines using those coordinates. That’s the gist. The actual implementation would depend on whether this needs to be dynamic. Perhaps you can just draw lines in Gimp / Photoshop / Paint and slap icons on top in the UMG.

But UMG is very limited with anything beyond the most basic. Awesome plugin.

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 11, 2022, 12:17pm UTC](https://forums.unrealengine.com/t/how-can-i-draw-multiple-lines-in-umg/473093/5 "2022-03-11T12:17:08Z")

</div>

@ilike9527 Is it safe to assume you repurposed the spline methods BPs are using for the wires?

---

<div class="post-metadata">

**Author:** ![ilike9527](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ilike9527](https://forums.unrealengine.com/u/ilike9527)\
**Post date:** [March 15, 2022, 10:35am UTC](https://forums.unrealengine.com/t/how-can-i-draw-multiple-lines-in-umg/473093/6 "2022-03-15T10:35:18Z")

</div>

Wow, thanks for letting me know that. I tried like your link and the lines can be previed in UMG editor. Sorry I have not tested the feature carefully.

---

<div class="post-metadata">

**Author:** ![ilike9527](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ilike9527](https://forums.unrealengine.com/u/ilike9527)\
**Post date:** [March 15, 2022, 11:09am UTC](https://forums.unrealengine.com/t/how-can-i-draw-multiple-lines-in-umg/473093/7 "2022-03-15T11:09:31Z")

</div>

Functions for spline rendering and editing is using slate original apis. Only functions for calculating spline rail location is similar as BPs, as they are all bezier splines, so they can be calculated the same way. And I have made some changes and limitions for 2D space, the functions work fine in my test.
