- Home /
Question by
PhoenixBlackReal · Aug 20, 2014 at 10:32 AM ·
rotationspritescale
Scaled sprite distorts on rotation in different resolutions
I have a 43x43 pixels sprite. I've done some playing around and this line of code scales the sprite on every resolution.
this.gameObject.GetComponent<SpriteRenderer>().transform.localScale = Vector3.Scale(transform.localScale, new Vector3 (1+ Screen.width/1366f, 2, 1));
Now, this looks a nice square on every resolution, etc. The only problem - it has to be rotated 45 degrees in the z axis. This, however - stretches the sprite on its x axis. I tried rotating an empty parent object, but to no prevail, what should I do? Thank you in advance.
P.S. I'm using c#.
Comment
I have never done this... do you have this line in an Update function? If yes try to put it in a Awake or Start function so that it will not updated every frame....