I'm trying to use the function Handles.DrawAAPolyLine to draw a line in the scene view.
However I can't seem to set the width of that line, it looks like it is 1 unit wide all the time. In the docs it points to HandleUtility.GetHandleSize to help adjusting the width, but I can't find where to use it.
The syntax is as follows:
static function DrawAAPolyLine (params points : Vector3) : void
static function DrawAAPolyLine (lineTex : Texture2D, params points : Vector3) : void
By using reflection I can see that Handles internally calls a function with a width parameter
private static function Internal_DrawAAPolyLine2 (Color color, Vector3 points, Texture2D texture, float width) : void
But that function is private, so I can't use it.
Anyone got any suggestions?
Thanks in advance
I tried DrawAAPolyLine for the first time today. I can't get it to draw anything.
There are overloads that take a width parameter, but that doesn't seem to help.
Note that you could use reflection to get a MethodInfo for the private method, then use MethodInfo.Invoke to call it. Dirty, but it might work. I'm not that desperate ... ;-)
Answer by vxssmatty
Sep 07, 2011 at 11:23 PM
reading this page:
You have to initialize the drawing system before you can actually use it. Similar to the runtime class GL.
Research the main class 'handles' and i hope that gets you going :D
EDIT: Realized this question is old, but hopefully someone can benefit from a pointer in the right direction
Handles.DrawPolyLine works fine, Handles.DrawAAPolyLine doesn't ... looks like a Unity bug to me. :-p
I havn't tested myself, so i couldn't confirm. So touche, that sucks =P bug needs filing! haha
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
3 People are following this question.
Custom scene view in editor window
Is it possible to determine wich Handles.PositionHandle is currently focused?
2d mode through Editor Script
Custom debug color display for scene view?
How do you hide a GameObject's handles?