How to have a constant pixel size element within a scaled with screen size canvas ?

Hi everyone!

Everything is in the title, I actually want to have a margin for the apple statusbar within a Canvas that has a CanvasScaler setted to “Scale With Screen Size”.

Is that possible?

Thanks in advance!

I found the solution.

I’ve created a script that takes the wanted constant pixel size and divide it with the canvas scale factor.
The scale factor can be found with this function :

 public Vector2 m_ReferenceResolution;
 public float ScaleWithScreenSize()
     Vector2 screenSize = new Vector2(Screen.width, Screen.height);
     return Mathf.Min(screenSize.x / m_ReferenceResolution.x, screenSize.y / m_ReferenceResolution.y);

then I simply set the computed size to the bar and move the main panel using the computed size.