You can use SpriteRender for the images. And position them inside of a parent GameObject
. Than it is enough to simply scale and position that one Parent GameObject
correctly (similar to the canvas but with normal Transform
components).
public class applySize : MonoBehaviour
{
private void Apply()
{
// Get the main camera position
var cameraPosition = Camera.main.transform.position;
// This makes the parent GameObject "fit the screen size"
float height;
if (Camera.main.orthographic)
{
// Camera projection is orthographic
height = 2 * Camera.main.orthographicSize;
}
else
{
// Camera projection is perspective
height = 2 * Mathf.Tan(0.5f * Camera.main.fieldOfView * Mathf.Deg2Rad) * Mathf.Abs(cameraPosition.z - transform.position.z);
}
var width = height * Camera.main.aspect;
transform.localScale = new Vector3(width, height,1);
transform.position = cameraPosition - new Vector3(0,height*.375f, cameraPosition.z);
// Since the 4 images are childs of the parent GameObject there is no need
// place or scale them separate. It is all done with placing this parent object
}
private void Start()
{
Apply();
}
}
Using the following Scene setup

The X positions of the Sprites simply are
- image1: - width * 1.5;
- image2: - width * 0.5;
- image3: width * 0.5;
- image4: width * 1.5;
and for the four SpriteRenderers

and the colliders

Result
(with an additional call in Update
)

I made the Parent position stay on Z = 0
. You can change this according to your needs.
This way the colliders should now be able to interact with other objects.