• 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 lvictorino · Jun 25, 2012 at 06:52 AM · renderinglinequad

How to draw a line?

This more a "yes or no" question than an actual question. I'm working on a game where the player can select elements. When he clicks on elements I draw a line between the previous selection and a the new one. I'm currently using the Debug.Drawline function to display the link between chosen elements but I need a final method.

My idea is to import a quad from Blender (to avoid using Unity planes which are full of vertex) scale it, rotate it, and display it always facing the camera.

My question: Is it the good technique to display lines or is there other techniques?

Comment
Add comment · Show 5
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 Mizuho · Jun 25, 2012 at 07:16 AM 1
Share

I have a similar type of game, and LineRenderer works pretty well. There's no significant problems with using LineRenderer as long as you don't have hundreds or thousands of lines.

avatar image Eric5h5 · Jun 25, 2012 at 07:41 AM 0
Share

Well, here's my standard link: Vectrosity.

avatar image Mizuho · Jun 25, 2012 at 07:43 AM 0
Share

@Eric5h5: You and your paid solutions. I think a lot of us happen to be Scrooges. Well, I'd like to think that.

avatar image Eric5h5 · Jun 25, 2012 at 07:49 AM 0
Share

That's why I don't post them as answers. I've written quite a lot of free scripts on the wiki which I also link to. Fortunately many people are not Scrooges.

avatar image Fattie · Jun 25, 2012 at 09:21 AM 0
Share

the price is too low, the only problem with most Asset store products

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Common_Horse · Jun 25, 2012 at 07:00 AM

You can use line renders, which allow you to define a start and end point, as well as width. This is generally more simple than using a quad, but I think it may be less efficient.

-AJ

Comment
Add comment · Show 8 · 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 Mizuho · Jun 25, 2012 at 07:14 AM 0
Share

It is less efficient because it requires the space for the GameObject and Component to hold it.

avatar image Common_Horse · Jun 25, 2012 at 07:20 AM 0
Share

True, but wouldn't you normally need to have a game object and mesh render component if you were to do it with a quad?

avatar image Mizuho · Jun 25, 2012 at 07:22 AM 0
Share

Unless you had Unity Pro, in which case it is drawn directly without anything to hold it.

avatar image lvictorino · Jun 25, 2012 at 07:28 AM 1
Share

@$$anonymous$$izuho @ArielJohnson I've tried Line renderer technique... but it seem to not always facing camera (example where I expect to have a square drawn: http://delta.riskle.com/~larles/unityline.JPG ) Is there something to know with LineRenderer while using an orthographic camera?

avatar image Mizuho · Jun 25, 2012 at 08:20 AM 1
Share

@lvictorino: You only need one LineRenderer to get a square. It's a bit of a trick because the LineRenderer rotates its lines by 90 degrees for every additional segment added to it, so if you draw over the same path four times, it looks like a solid line to the camera.

Show more comments

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

9 People are following this question.

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

Related Questions

Object turns pink when changing material at real time: 1 Answer

Rendering a simple Quad on Android is buggy 1 Answer

2D: Quad/Other Objects always behind my Tiled Map Mesh. 0 Answers

Vertex ordering problem with GLSL Tessellation when using quads in Tessellation Evaluation Shader stage. 0 Answers

overlaying object problem 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