GetNormalizedPivot() public static méthode

public static GetNormalizedPivot ( Sprite sprite ) : Vector2
sprite UnityEngine.Sprite
Résultat Vector2
Exemple #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);
        }