GetPixelsToUnits() 공개 정적인 메소드

public static GetPixelsToUnits ( Sprite sprite ) : float
sprite UnityEngine.Sprite
리턴 float
예제 #1
0
        private void ShiftTransformAfterResize(Transform transform, Sprite sprite, int oldWidth, int oldHeight, int newWidth, int newHeight)
        {
            Vector2 pivot         = Utility.GetNormalizedPivot(sprite);
            float   pixelsToUnits = Utility.GetPixelsToUnits(sprite);
            Vector2 sizeDelta     = new Vector2(newWidth - oldWidth, newHeight - oldHeight);

            transform.Translate(Vector2.Scale(sizeDelta, pivot) / pixelsToUnits, Space.Self);
        }