• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Kazuva · Jun 11, 2016 at 09:59 AM · linerenderer

Is there a way to have line renderer on a canvas?

i'd love to know if there was a way to get my lineRenderer on a canvas (or some other way to draw lines on a canvas)

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

5 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by EdwinChua · Apr 11, 2017 at 01:46 AM

If anyone's still looking for the answer: https://forum.unity3d.com/threads/render-lines-on-top-of-panel-ui-element.287023/

Use "Screen Space - Camera", assign the camera, and increase the width of the line so it becomes visible.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image nieyoub23 · Apr 26, 2017 at 05:26 PM 0
Share

THAN$$anonymous$$ YOU!

avatar image Harinezumi · Jul 02, 2017 at 12:43 PM 0
Share

That was the solution I was looking for the past 2 hours! Thank you!

avatar image sergpxng · Jul 12, 2021 at 12:18 PM 0
Share

This is the solution! Create a separate canvas for you lines and follow the stated steps

avatar image
1

Answer by filip_andry · Aug 13, 2016 at 08:44 AM

Hi just use a panel filled with any color you want and use Height and Widith to set the length and the widith of your line,

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image i3130002 · Jul 24, 2019 at 09:33 AM 0
Share

I spend hours going went down this rabbit hole, wish you had been provided a sample code.

avatar image DenisK_WRG i3130002 · Aug 01, 2019 at 07:31 PM 0
Share

I guess he suggests not very optimal way to draw with empty Image line line. But it's fit to draw single line (like progress for example).

avatar image
0

Answer by Mmmpies · Jun 11, 2016 at 11:21 AM

Just tried this and it simply doesn't render on the UI. I can see the line on the canvas exactly where I expect in the scene view but it's not there on the Game view.

However whilst looking at why it wasn't rendering I came across this page ...

http://forum.unity3d.com/threads/new-ui-and-line-drawing.253772/

Maybe that'll help.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image pradip_spixel · Aug 03, 2018 at 06:03 AM 0
Share

can i draw multiple line using line renderer???

avatar image Harinezumi pradip_spixel · Aug 03, 2018 at 07:39 AM 0
Share

First, please don't ask new questions in comments, ins$$anonymous$$d ask a new question - it is free.

Anyway, the answer is no, unless you use a hack. The moment you change the position of points, it will render in a different place.

The hack would be to add the last point of each line again with a fully transparent color, and then add a point for the first point of the next line, also transparent, then you start adding the points of the second line, and so on. Basically you create single line, but with transparent segments to separate parts. But I don't recommend this, because I'm almost certain it is less efficient than multiple LineRenderers.

avatar image
0

Answer by lampyridae · Nov 09, 2018 at 03:55 PM

I ran across two other solutions not mentioned here while looking for a way to draw lines in a UI canvas. These solutions probably don't apply to all situations, but they may be helpful to some.

Render Texture Solution

  • Create a Render Texture in your assets.

  • Create a second camera in your scene.

  • In your second camera's Target Texture option, specify your new Render Texture.

  • Assemble your Line Renderer and some background Quad some distance away from your GameObjects. Make your second camera watch that.

  • Create a Raw Image in your Canvas and have it render your Render Texture.

Low Level Graphics Solution

  • Use Unity's low level graphics library: GL.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by unity_LmmLqTPyJHdvDg · Jan 10, 2019 at 09:45 AM

Nothing works for me... I have the canvas on the camera, the z axis, the material and all but I still can't figure out why I'm unable to see the lines in the gamemode.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DenisK_WRG · Aug 01, 2019 at 07:33 PM 0
Share

$$anonymous$$aybe clip plane property of camera (canvas)?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

68 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to add a fading laser effect to my laser gun ? Unable to fade out the currently used line renderer over time. 1 Answer

LineRender weird render points. 0 Answers

Why does line renderer color is gray with 255, 255, 255 RGB? 0 Answers

Can't get a smooth following line 1 Answer

Line Renderer how to move individual keys 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges