Updated Curly UI to wait until end of the frame to recalculate positions

Also updated Editor script to work in 2022

Resolves:
- https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/409
pull/413/head
Simon Jackson 2022-11-27 15:14:52 +00:00
parent c5a8af63f8
commit c2ada36c41
2 changed files with 13 additions and 0 deletions

View File

@ -68,7 +68,12 @@ namespace UnityEngine.UI.Extensions
Handles.color = Color.gray;
EditorGUI.BeginChangeCheck();
#if UNITY_2022_1_OR_NEWER
Vector3 newCornerPos = Handles.FreeMoveHandle(script.transform.TransformPoint(cornerPos), HandleUtility.GetHandleSize(script.transform.TransformPoint(cornerPos)) / 7, Vector3.one, Handles.SphereHandleCap);
#else
Vector3 newCornerPos = Handles.FreeMoveHandle(script.transform.TransformPoint(cornerPos), script.transform.rotation, HandleUtility.GetHandleSize(script.transform.TransformPoint(cornerPos)) / 7, Vector3.one, Handles.SphereHandleCap);
#endif
Handles.Label(newCornerPos, string.Format("Corner Mover"));
newCornerPos = script.transform.InverseTransformPoint(newCornerPos);

View File

@ -1,6 +1,7 @@
/// Credit Titinious (https://github.com/Titinious)
/// Sourced from - https://github.com/Titinious/CurlyUI
using System.Collections;
using System.Collections.Generic;
#if UNITY_EDITOR
@ -286,6 +287,13 @@ namespace UnityEngine.UI.Extensions
public void Refresh()
{
StartCoroutine(RefreshOnNextFrame());
}
public IEnumerator RefreshOnNextFrame()
{
yield return new WaitForEndOfFrame();
ReportSet();
// we use local position as the true value. Ratio position follows it, so it should be updated when refresh