Hide
ScaleHandle

Draw a scale handle on the target to adjust.

  • If it's a Vector2, save the scale as Vector2
  • If it's a Vector2Int, save the scale as Vector2Int
  • If it's a Vector3, save the scale as Vector3
  • If it's a Vector3Int, save the scale as Vector3Int
  • If it's a number (int, double, float, long etc.), use it as a uniform xyz scale. When write back from the handle, save the x value.

Parameters

  • string space = "this": parent of the handle. When using this, use the current object as target space. When using null, use world space. Otherwise, use the target field/callback as the parent.
  • float posXOffset = 0f: local position offset at the x axis
  • float posYOffset = 0f: local position offset at the y axis
  • float posZOffset = 0f: local position offset at the z axis
  • string posOffsetCallback = null: use a field/callback as the local position offset. Must return a Vector3.
using SaintsField; [ScaleHandle] public Vector3 localScale3 = Vector3.one; [ScaleHandle] public Vector2 localScale2 = Vector2.one; [ScaleHandle] public Vector3Int localScale3Int = Vector3Int.one; [ScaleHandle] public float uniformScale = 1f; public Transform root; // use callback target as handle parent space [ScaleHandle(nameof(root))] [OnValueChanged(nameof(ApplyScaleToChild))] public Vector3 scaleInside; public Transform applyTo; private void ApplyScaleToChild(Vector3 scale) { applyTo.transform.localScale = scale; }