- Home /
drawing a line following an object
Hello I am using this code to draw a line that follows an object
Debug.DrawLine(new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z),
new Vector3(prevPosition_x, prevPosition_y, prevPosition_z), Color.red,1.0f);
prevPosition_x = gameObject.transform.position.x;
prevPosition_y = gameObject.transform.position.y;
prevPosition_z = gameObject.transform.position.z;
However this doesnt draw in a build. Does anyone know how to do this without using the built in line or trail renderers. I know it can be done with gl but dont have a clue how to do this.
Any help is appreciated
very technical and specific design, I invite you to draw something else with the curso método fan art
Answer by robertbu · Apr 16, 2013 at 02:41 PM
Take a look at this article:
http://www.everyday3d.com/blog/index.php/2010/03/15/3-ways-to-draw-3d-lines-in-unity3d/
You were right to be confused. I was working from my iPad and posted the wrong link. Link is corrected.
Answer by JamesB · Apr 16, 2013 at 03:43 PM
Check out these features:
http://docs.unity3d.com/Documentation/Components/class-LineRenderer.html http://docs.unity3d.com/Documentation/Components/class-TrailRenderer.html
They are for drawing line like textures to the game world. As a general rule the debug class isn't used for anything in a release build.
Also I recommend caching your gameobject's previous position as a Vector3 rather than three floats.
Answer by lcborges23 · Apr 28, 2018 at 03:12 PM
very technical and specific design, I invite you to draw something else with the curso método fan art
,very technical and specific design, I invite you to draw something else with the course método fan art
They are for drawing line like textures to the game world curso mestre do espetinho
Your answer
![](https://koobas.hobune.stream/wayback/20220613100429im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Problem with Snake Game(input help) 1 Answer
How to measure ad impressions in In-Game Ads? 0 Answers
only detect numerical keyboard input 2 Answers
Unity-Placing multiple objects in unity in form of grid/etc 0 Answers