x


Using Handles.DrawAAPolyLine

Hi

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

more ▼

asked Jan 23 '11 at 01:17 PM

TowerOfBricks gravatar image

TowerOfBricks
3.8k 18 28 56

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 ... ;-)

Sep 07 '11 at 10:39 PM yoyo
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

reading this page:

http://unity3d.com/support/documentation/ScriptReference/Handles.html

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

Matty

more ▼

answered Sep 07 '11 at 11:23 PM

vxssmatty gravatar image

vxssmatty
121 4 6 6

Handles.DrawPolyLine works fine, Handles.DrawAAPolyLine doesn't ... looks like a Unity bug to me. :-p

Sep 08 '11 at 01:10 AM yoyo

I havn't tested myself, so i couldn't confirm. So touche, that sucks =P bug needs filing! haha

Sep 08 '11 at 02:28 AM vxssmatty
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2365
x432
x126
x54

asked: Jan 23 '11 at 01:17 PM

Seen: 1366 times

Last Updated: Sep 08 '11 at 03:51 AM