Comparing positions of two UI elements on different canvases with different scaler modes!

Hi,

I have two canvases in my project:

  1. Main Canvas with a scaler set to Scale with Screen Size
  2. Secondary Canvas, for some touch-based UI components, with a scaler set to Constant Physical Size in inches

For mouse-keyboard builds all UI objects are on Main Canvas.
For touch-screen builds some UI objects are on Secondary Canvas.

In some custom layout code, I need to make sure a UI object on Main Canvas doesn’t overlap an object on Secondary Canvas.

How can I normalize the position of the object in Secondary Canvas into Primary Canvas coordinate space for comparison?

Thanks.

I’d try using transform.TransformPoint and InverseTransformPoint to convert its coordinates to and from world space.

Thanks! I managed to get this working using that method!