Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity UI Force refresh UI in editmode

Discussion in 'UGUI & TextMesh Pro' started by Le_Poulet, Jul 28, 2021.

  1. Le_Poulet

    Le_Poulet

    Joined:
    May 18, 2017
    Posts:
    24
    Hi,
    I make a custom tween tool and I'm facing a problem to refresh UI in edit mode. I have an EditorWindow that update some elements on the scene. Transforms (3d mesh and sprite) are updated correcly but UI isn't refreshing. Its always refreshing when i click on the UI element in the hierarchy. I try Canvas.ForceUpdateCanvases(),
    myRectTransform.ForceUpdateRectTransforms() and SceneView.RepaintAll() but nothing works.

    Am I missing something?
     
  2. Le_Poulet

    Le_Poulet

    Joined:
    May 18, 2017
    Posts:
    24
    Oh! I found the solution (not really me, my mate did).
    The key was to use EditorApplication.QueuePlayerLoopUpdate() and the magic happens!
     
    FelixRay likes this.