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
10
Question by Suyuanhan · Oct 05, 2011 at 06:46 AM · linedraw

Draw a line in Game View?

As I know to draw a line in Scene View is easy to use Debug.DrawLine() function,

But I want to draw lines in Game View,How to do that?

Comment
Add comment · Show 4
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 syclamoth · Oct 05, 2011 at 07:26 AM 0
Share

Can you use a line-renderer? Or do you rely on your lines being always one pixel wide?

avatar image CHPedersen · Oct 05, 2011 at 07:51 AM 1
Share

If this is for Debug purposes, and you just want the lines drawn by Debug.DrawLine to be visible, you can enable them by hitting the "Gizmos"-button in the top right corner of the window.

If this is for use in the final game/app, then you need to use a LineRenderer, as @syclamoth suggested.

Or, if you have a few bucks to spare, check out Vectrocity, which has a lot of line drawing functionality custom tailored for exactly this purpose.

avatar image Suyuanhan · Oct 05, 2011 at 07:55 AM 0
Share

Thanks,and I found a document http://unity3d.com/support/documentation/ScriptReference/GL.html

avatar image syclamoth · Oct 05, 2011 at 08:00 AM 0
Share

I'd have suggested that, but it's not exactly simple to use... I also wasn't sure if you were using Unity Pro or not.

5 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by Ev · Oct 27, 2013 at 09:12 PM

Try this tutorial:

http://www.everyday3d.com/blog/index.php/2010/03/15/3-ways-to-draw-3d-lines-in-unity3d/

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 nhawk · Apr 20, 2014 at 05:23 AM 0
Share

404 error. Does anyone have an updated link?

avatar image robertbu · Apr 20, 2014 at 06:15 AM 0
Share

The link was good just a week ago, so I'd wait a day and see if the site comes up again.

avatar image
2

Answer by Marnix · Oct 05, 2011 at 07:54 AM

Please check the search of this Qota, before posting a question.

You can find your answer easily in the first 3 results: http://answers.unity3d.com/search.html?redirect=search%2Fsearch&q=draw+line

http://answers.unity3d.com/questions/17863/line-render-draw-line.html
http://answers.unity3d.com/questions/8338/how-to-draw-a-line-using-script.html

So, use a line renderer, use GL-class. Or use something from the forum. I have seen a couple of techniques and packages that handle it for you, but mostly not in the free version if you are looking for 1px wide lines.

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 Simon-O · Feb 24, 2014 at 03:57 PM 2
Share

Of course, this Q is now the first Google result - so everyone comes here to find a list of links elsewhere.

avatar image jtsmith1287 · Oct 25, 2014 at 09:32 PM 0
Share

And the first link is broken, haha

avatar image blah · May 01, 2016 at 04:42 PM 5
Share

Why does an "answer" with no direct answer have so many upvotes? This question shows up in google, so upvoting something that starts with "Please check the search" is really silly. If this specific instance of this question is considered a duplicate, close it and make a proper redirect to one that has a good answer ins$$anonymous$$d of wasting the answers.unity3d.com space with non-answers..

avatar image
1

Answer by Cherno · May 01, 2016 at 07:06 PM

This solution uses OnGUI to draw a line of variable width:

DrawLine

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 2FlyDreams · Dec 05, 2013 at 03:17 PM

You can try "Dream Paint" ( Asset Store Link ). It allows to draw 2D and 3D primitives in game and in editor, and many others features ...

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 GluedBrain · May 10, 2015 at 06:50 AM

Refer to this post on TGC Draw line on screen

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 roger_lew · May 20, 2015 at 05:46 AM 1
Share

link is broken

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

13 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

Related Questions

Click objects to draw a line between them 0 Answers

Drawning Line Problem useing custom class 1 Answer

Draw a line to a new pontential character position/target 1 Answer

Draw path for the ball 1 Answer

how can i animate line between object 1 Answer


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