- Home /
How do I shrink a cube with scripts?
I'm making a 2D game and a character needs to crouch. The material Sets to a picture of someone crouching, but the box stays the same size. How do I make it shrink to the size of the image file of the texture? If imposible, how else can i make a 2d character made from one shape crouch?
Comment
Answer by Meltdown · Jul 24, 2011 at 08:19 AM
Take a look at transform
You would need to adjust the value using the localscale property of the transform. i.e
transform.localScale.y = 0.5;
I had to do this, and it didnt work :(
Vector3 temp = new Vector3(1.0f, 0.5f, 1.0f); transform.localScale.Scale(temp);
Your answer
Follow this Question
Related Questions
!texture.texture error 0 Answers
Scaling / Resizing an Image (Texture2D) 6 Answers
Material not updating on Image 2 Answers
Set image as material 0 Answers