Conception of resolution between UI Builder, Simulator and code

I would like to understand and more master the concept of resolution with the aim to locate perfectly my GameObjects and UIDocuments (into a Canvas).

I have a issue between many data declaration, interface and debug code which result to bad locate/put elements in my game.

To better understand you can view some screenshoot of my UI Builder, simulator and debug window and focus to resolution param et locate elements like this

You can see that :

  • uxml file define size with game view that corresponding to simulator Apple Ipad Pro 12.9 (2732x2048)
  • the test2.uxml container is more heighter than simulator
  • the end of height of uxml is not the the end of canvas or device simulated by Unity

You can see that:

  • resolution is selected by choice of the iPad device
  • the buttons into my VisualElement container is on bottom of screen device whereas is in the middle into UI Builder

You can see that:

3 differents declaration of résolution

  • Screen.width
  • UnityEditor.PlayerSettings.defaultScreenWidth
  • UnityEditor.Handles.GetMainGameViewSize())

Questions. From reading this report can you tell me:

  • Why locate of VisualElement is different between UI Builder and simulator ?

  • Why I have 3 differents declaration of resolution value ?

  • Why Canvas size (with match game View) do not match with simulator resolution ?


Thank you for your help and your advice !