Cutting sprite instead of stretching

Hi, I’m using a Raycast system™ to determine the size of my sprite laser. To increase / decrease the sprite I use transform.scale.x. The problem is that I need to cut the sprite to the desired size and not stretch it. How do I do this?
Example stretching sprite:

30441-screenshot_4.png
30444-screenshot_3.png

Thanks in advance.

Change from using a Sprite to display the laser beam and use a Quad instead. Then you can adjust the tiling/scale in material:

http://docs.unity3d.com/ScriptReference/Material-mainTextureScale.html

You’ll have to map your transform.localScale.x changes to the mainTextureScale changes.

 renderer.material.mainTextureScale = Vector2(transform.localScale.x, 1.0);

Note you can take this a bit further. If you create just one section of the beam and make that section tile, then you can create a whole beam out of just a small section.