How to save player movement path as a picture?


Could use a Linerenderer, although there might be better solutions that I am unaware of.

I don’t want the path to be drawn while playing, i need the collectibles appear in that path, then the path the player moved is saved in a picture.

here you go… attach this to the character and save the image when you are done.

public int imagewidth;
	public int imageheight;

	public int worldtop;
	public int worldbottom;
	public int worldright;
	public int worldleft;
	public float xratio,yratio,x,y;
	public Texture2D image;
	public int pixx,pixy;

	void Start () {
		int x, y;
		worldtop = 500;
		worldbottom = -500;
		worldright = 500;
		worldleft = -500;
		imagewidth = 600;
		imageheight = 600;

		xratio = imagewidth/(float)(worldtop - worldbottom);
		yratio = imageheight/(float)(worldright - worldleft);

		image = new Texture2D (imagewidth, imageheight);
		x = imagewidth;
		while(x>0){x--;y = imageheight;
		}image.Apply ();

	void Update () {
	   x = transform.position.x;

		//use transform position z below if you are 3d;
	   y = transform.position.y;

		pixx = (int)((x - worldleft) *xratio);
		pixy = (int)((y - worldbottom)*yratio);

		image.SetPixel (pixx, pixy, Color.white);
		image.Apply ();
	void OnGUI(){
		GUI.DrawTexture (new Rect (0, 0, 300, 300), image);