I have the following code to make a sprite rotate around a character in 2D towards the mouse pointer, however, I’d like to know how to increase the sprite renderer size so that it stretches from the player to the mouse pointer. At present, when I increase size, it obviously increases the size on both ends of the Sprite Renderer. I’d like to only increase the size on one side. I think the only way to do this is to move the sprite’s position relative to the size increase and parent object, which I’m having difficult time with.

Also, the reason I’m not using LineRenderer is becasue I have a 2D collider on the sprite, otherwise I would have and the problem would have been solved hours ago.

		float angle;
		Vector3 mousePos = Input.mousePosition;
		Vector3 objectPos = Camera.main.WorldToScreenPoint(this.transform.position);
		mousePos.x = mousePos.x - objectPos.x;
		mousePos.y = mousePos.y - objectPos.y;
		angle = Mathf.Atan2(mousePos.y, mousePos.x) * Mathf.Rad2Deg;
		transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle));
		if(this.transform.tag == "Laser")
		{
			mousePos = Input.mousePosition;
			Vector3 worldPos = worldCamera.ScreenToWorldPoint(mousePos);
			float x = worldPos.x;
			float y = worldPos.y;
			float z = worldPos.z;
			float beamx = this.transform.position.x;//* 15.0f;
			float beamy = this.transform.position.y;// * 15.0f;
			float beamz = this.transform.position.z;// * 15.0f;


			float distance = Vector3.Distance(new Vector3(x, y, 1), new Vector3(beamx, beamy, 1));
			print (beamx+" "+beamy+" "+beamz + " Distance: "+distance+ " "+this.transform.localPosition+" "+worldPos);
			transform.localScale = new Vector3(distance/transform.parent.transform.localScale.x, 1.0f/transform.parent.transform.localScale.y, 1.0f/transform.parent.transform.localScale.z);
			this.transform.position = transform.parent.position;
                    //insert code to reposition the line so it looks like it is only increasing in size only on one end
		}

You can change the localScale vector. Changing the X will change the size of the sprite in the X plane:

transform.localScale += new Vector3(1, 0, 0); // increase the X scale by 1.

For drawing lines from point A to point B, you might want to look at my answer here: Vectrosity line with collider? - Unity Answers

It uses 3d cubes and not sprites, but the idea is the same.

Edit: Here is a modified script that should work when the arrow is pointing right instead of up, and with a sprite instead of cube:

public void DrawLine(Transform linePrefab, Vector3 from, Vector3 to, float lineWidth) {
    framesWithoutFiring = 0;
 
    // calculate vector from point A to point B
    Vector3 lineVector = to - from;
 
    // instantiate line
    Transform lineInstance = GameObject.Instantiate(linePrefab);
 
    // set position of line instance to center of line
    lineInstance.position = from + (lineVector / 2f);
 
    // set rotation of line instance so that it's Y axis is from point A to point B
    lineInstance.transform.right = toTarget.normalized;
 
    // set length of line instance
    lineInstance.transform.localScale = new Vector3(lineVector.magnitude, lineWidth, lineInstance.transform.localScale.z);
}

Now when you use it, simply provide the parent’s position in the “from”, and the mouse’s position in the to (don’t forget to translate mouse screen position to world position with camera.main.ScreenToWorldPosition)