c# - Scaling a sprite in unity -


i trying make sprite same proportion screen sizes. there way can scale sprite width , or height compared rest of screen? have tried multiple ways have looked goes on head. there easy way implement this? or way @ in unity? help. here image further trying accomplish.

enter image description here

i want detailed image size of black , green rectangle. help!

i figured out, needed convert pixels per world unit so:

     mathf.abs(camera.main.orthographicsize - (getcomponent<spriterenderer>().sprite.texture.height / getcomponent<spriterenderer>().sprite.pixelsperunit)); 

Comments

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -