- Home /
How to catch a Vector3-value by clicking at a world position in editor mode?
I use a public Vector3-variable in one of my component scripts. Now I'd like to attach a value to this variable via inspector. Thereafter I can see three input fields for x, y and z. This approach is quite inconvenient for selecting points in the world for many objects. Is there a possibility to catch a Vector3-value by just clicking in the world without the need to start the game? So I'd like to click somewhere (with or without a hotkey) and the inspector fills in the values for x, y and z automatically.
Answer by Aranhawebs · Aug 16, 2012 at 07:47 PM
Try to create a public "transform" instead of a Vector3. So you can link the target object in Transform. If this is to the starting position of the Object, you can create an empty object with the coordinates of where you want to start it and link in the Inspector.
Answer by urg0tt · Aug 17, 2012 at 03:31 PM
Thank you for answering my question. But that is not really what I wanted. My hotspots need a walk-to point. So a simple Vector3 would be enough, but placing a simple Vector3 in the world isn't that comfortable. So I'm using now a transform attribute as you said. I fill it with an extra game object (a sphere) to mark the area where the character shall move to. - But this is still more than I need and it needs more performance.