Correct space GUI elements?

How do I go about correctly spacing gui elements, say textures, that are 32x32 pixel blocks. I’ve got an orthogonal camera set up, size of 540.

How do I ensure that the elements will be correctly spaced? As of now, I can’t even find a way to space them so they’re side by side. That is, I can’t find a way to convert pixel size to viewport coordinates.

Hi, not tested but you can try something like this:

        public Rect guiRect;
        public float spacing;
        public Texture[] texture;
    
        
        void OnGUI()
        {
            for(int i = 0; i < texture.Length; i++)
            {
                GUI.DrawTexture(new Rect(Screen.width / guiRect.x * (i * spacing), Screen.width / guiRect.y, texture<em>.width + guiRect.width, texture_.height + guiRect.height), texture*,ScaleMode.StretchToFill);*_</em>

}
}