- Home /
Unity2D resize the sprite
I hav sprite 600 * 400 and Pixels Per Unit is 1
It show in the Scene is 600 * 400.
Now,I want to resize my sprite to any size via I input the value in inspector.
For example, I input Width:50 Height:100 then the sprite in Scene is 50 100 I input Width:200 Height:300 then the sprite in Scene is 200 300
I try to use the code "GetComponent ().bounds.size.Set (50f, 100f, 0.2f);"
but it's no use.
How can I implement it?
Comment
Don't use set, use a Vector3
GetComponent().bounds.size = new Vector3(50f, 100f, 0.2f);