- Home /
Draw a line via script and make a solid with it..
Hello everybody! I'd like to know how to draw lines via script to make a solid figure, for example a cube, a triangle or a circle. After this I'd like to "extrude" the shape and give it a size (thickness).
I found Handles.Drawline on the help and this is the code I wrote:
var dot1 : Vector3; dot1.x=0; dot1.y=0; dot1.z=0;
var dot2 : Vector3; dot2.x=100; dot2.y=0; dot2.z=0;
function Start() {
var linea = Handles.DrawLine(dot1,dot2);
}
This gives me an error: Unknown identifier : Handles. Where is my error?
And then when I finally create my line and my shape how do I extrude it? Thank you very much.
Answer by Eric5h5 · Mar 19, 2010 at 05:44 PM
Handles is an editor class, and can only be used in editor scripts (which must be placed in a folder called Editor in your project's Assets folder), and will only work in the editor.
To create solid shapes, you don't need to extrude anything; use the Mesh class.
Just so you know, you can declare variables like this:
var dot1 = Vector3(0, 0, 0);
(or in that particular case, "Vector3.zero".)
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
How to draw a line between two points in Unity 2 Answers
Drawning Line Problem useing custom class 1 Answer
How would I replicate Gizmos.DrawLine in-game? 1 Answer
Drawing Gizmos in Editor Slow? 1 Answer