• 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 Eddie 2 · Jan 10, 2011 at 10:15 AM · vector3handlesbce0017

Guidance needed to use Handles.DrawAAPolyLine in JS

Hi guys, I'm trying to use this function to draw a line on the screen:

Handles.DrawAAPolyLine

I pass in a Vector3[] array but i got a compile error:

BCE0017: The best overload for the method 'UnityEditor.Handles.DrawAAPolyLine(*UnityEngine.Vector3[])' is not compatible with the argument list '(UnityEngine.Vector3[])'.

what does this mean? Thanks .

Comment
Add comment · Show 2
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 Statement · Jan 10, 2011 at 11:22 AM 0
Share

Could you please post a bit more information? I made a quick repro and I couldn't get this error. I'd like to see your call to DrawAAPolyLine and the definition of the object passed in.

avatar image Statement · Jan 10, 2011 at 11:23 AM 0
Share

Actually, what happens is that I get the error in JS but not in C#. It is probably due to the params type.

2 Replies

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

Answer by Statement · Jan 10, 2011 at 11:39 AM

The error says that the function has a parameter type of *Vector3[] (pointer to vector3 array). You are passing in a Vector3[] (vector3 array - not a pointer to one). In C#, the signature reads as params Vector3[], which means that you can pass several Vector3s separated by comma, or send a vector3 array. I think this is a design bug in Unity.

It seems that the function expects a pointer to an array of Vector3. I am not well versed in JS to know how to obtain a pointer, or if it is even possible to obtain the pointer of an array. Until someone else post a definite answer how to solve this in JS I can present you a workaround with C# code, proxying the call without the params version. Your JS code can then call this instead of Handles.

Put this in Standard Assets folder to ensure it compiles before your script.

using UnityEngine; using UnityEditor;

/// <summary> /// Handles eXtension. /// Provides support to DrawAAPolyLine functions for JS. /// </summary> public static class HandlesX { public static void DrawAAPolyLine(Vector3[] points) { Handles.DrawAAPolyLine(points); } public static void DrawAAPolyLine(float width, Vector3[] points) { Handles.DrawAAPolyLine(width, points); } public static void DrawAAPolyLine(Texture2D lineTex, Vector3[] points) { Handles.DrawAAPolyLine(lineTex, points); } public static void DrawAAPolyLine(Texture2D lineTex, float width, Vector3[] points) { Handles.DrawAAPolyLine(lineTex, width, points); } }

Then you can use HandlesX.DrawAAPolyLine in a similar fashion, from your JS code.

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 Eddie 2 · Jan 12, 2011 at 06:53 AM

The error is gone after I passed in the elements of the vector3 array instead of the whole array:

Handles.DrawAAPolyLine(vecArray[0], vecArray[1], vecArray[2]);

I get the error if I pass in vecArray:

Handles.DrawAAPolyLine(vecArray);

this is the function declaration:

static function DrawAAPolyLine (params points : Vector3[]) : void 

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.

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

No one has followed this question yet.

Related Questions

Can't call Handles.DrawPolyLine() from Boo 1 Answer

How to make a Race Standing / Position Indicator 0 Answers

I thought I was doing this right, but it gives me an error. 0 Answers

Vector3 is always subject to serious stutter in Translation 0 Answers

how do i make a vector3 that points away from a collision point? 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