I want that its height also fit to the every mobile screen,
for orthographic camera, put this on your camera:
private float orthoSize, aspect;
void Start()
{
orthoSize = 5;// size of your camera in inspector
aspect =16/9; //your scene aspect ratio or target screen resolution = 1920/1080 , 1280/720, 4/3…
Camera.main.projectionMatrix = Matrix4x4.Ortho(-orthoSize * aspect, orthoSize * aspect, -orthoSize, orthoSize, Camera.main.nearClipPlane, Camera.main.farClipPlane);
}
I am getting error as unexpected symbol ‘aspect’