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][1] [1]: https://comodesenharonline.com/metodo-fan-art/

–

3 Answers

3

Take a look at this article:

http://www.everyday3d.com/blog/index.php/2010/03/15/3-ways-to-draw-3d-lines-in-unity3d/

how does this help im confused

–

You were right to be confused. I was working from my iPad and posted the wrong link. Link is corrected.

–

Check out these features:

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.

targetPoint is the transform that I want to test and see if it is in the cameras view. You should replace this with the transform you want to test. playerHead.leftCamera is the camera that you are checking the object against. You should replace this with the camera you want to use. onScreen is a variable that is true when "targetPoint" is in view of "playerHead.leftcamera"

–

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][1] [1]: https://atalhodosucesso.com/curso-mestre-do-espetinho

–