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\$
  • \$\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 Nov 30 '15 at 20:41
  • \$\begingroup\$ offtopic: Whoa, a vector creator? I want this! \$\endgroup\$ – S. Tarık Çetin Nov 30 '15 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 Dec 1 '15 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 Dec 1 '15 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.