Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
avatar image
1
Question by mlarkins · Aug 25, 2017 at 06:48 PM · 2duirenderingcanvaslinerenderer

LineRender width not consistent across resolutions

I have a LineRenderer as a child of a canvas. If I remove "Use World Space," on the LineRenderer, the endpoints correctly stay anchored to the canvas as I switch to various resolutions (they stay at the same relative positions). The width however, does not locally stay consistent.

For instance if the width is set to 0.12 at 1920x1080, it needs to be set to 0.09 at 1134x750 in order to match the space it takes up on the canvas. For 2048x1536 it needs to be set to 0.06.

What is the proper way to make line render widths remain consistent to the canvas across different resolutions?

Comment
Add comment · Show 6
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 hexagonius · Aug 26, 2017 at 03:45 AM 0
Share

This sounds wrong. Scaling down even though the resolutions mentioned are larger AND smaller than the reference resolution? This is from the docs and should help you figuring out how to calculate the right width:

The Line Renderer does not render one-pixel-wide lines. It renders billboard lines (polygons that always face the camera) that have a width in world units and can be textured

avatar image mlarkins · Aug 28, 2017 at 03:03 PM 0
Share

Try it for yourself! Create a Canvas, Create a game object with a line renderer, turn off "Use World Space" on the LineRenderer and see that if you switch between resolutions, you get various widths that don't really correspond to resolution sizes in a meaningful way (or at least that I can tell!).

It's strange that something as basic as line renderers have highly variable line widths at various resolutions. Anyone know how this is calculated?

avatar image misher · Aug 29, 2017 at 01:02 PM 0
Share

Why use line renderer inside canvas? Line renderer is more for 3d space and it's not a sprite that can adapt his properties acccording to canvas.

avatar image mlarkins misher · Aug 29, 2017 at 01:06 PM 0
Share

Why? Because a line renderer can otherwise achieve what is needed (being able to draw a line with many points, smooth corners, interpolate colors down a gradient, etc). Why recreate all of this functionality when everything else, except for the width, is working properly?

I'm hoping someone can shed light on how the width is calculated or how to make a resolution independent solution for drawing lines.

avatar image misher mlarkins · Aug 29, 2017 at 01:27 PM 0
Share

introduce width coefficient, calculate it at the start of application in base of resolution, and multiply every line width by it.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by ChrisBellU · Sep 12, 2018 at 11:01 AM

Hit this problem just now (2018.2.5). The width isn't scaled with the LineRenderer even if the line is locally scaled.

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

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.

Follow this Question

Answers Answers and Comments

165 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 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 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

Raw image not visible in overlay canvas 0 Answers

How to scale according to different mobile resolutions? 0 Answers

Changing button positions on different resolutions 1 Answer

Custom Transparency Axis Canvas Rendering Order 0 Answers

Canvas items turned to be blank images 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