2
\$\begingroup\$

I'm starting to dig into Unity's editor customization. What I'm looking for is a way to create custom line (or a point at least) which I could move around in SceneView and set a Vector2 value that way.

Picture might explain it somewhat better

I might create a child GameObject and then calculate the relative distance, but I'd like to know, if there is any way using the Editor instead of adding other useless GameObjects.

Thanks in advance.

\$\endgroup\$
4
  • \$\begingroup\$ I don't have time to write a full answer just now, but to get you started: Unity uses the Handles class to draw & use its interactive widgets in the scene. You can use these by writing a custom editor for your class with an OnSceneGUI method. \$\endgroup\$
    – DMGregory
    Commented Nov 30, 2015 at 20:41
  • \$\begingroup\$ offtopic: Whoa, a vector creator? I want this! \$\endgroup\$ Commented Nov 30, 2015 at 21:03
  • \$\begingroup\$ Just checking: what you are trying to achieve is a visualization of a vector? Displaying it as a gizmo-line works for you? \$\endgroup\$
    – MAnd
    Commented Dec 1, 2015 at 4:26
  • \$\begingroup\$ Yeah, that's exactly what I would like to get. Instead of hard-coding the vector myself it would be much easier if I could easily see another "transform" (drawing the vector shouldn't be a huge problem) in the SceneView and be able to edit it. I've looked at the Handles but I haven't really found the solution yet. \$\endgroup\$
    – MSKL
    Commented Dec 1, 2015 at 19:17

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.