So I want my game view to ONLY show the background, none of the blue. Is there anyway it will automatically do this no matter what screen size it’s on? Or if someone can send me a tutorial with this information would be awesome too.
If you’re bored of reading too much stuff and want some visual explanation. Check this out. This has pretty much everything you want
if your bakcground is set OnGui() will only need to especify the width of background as Screen.widht and the height at Screen.height
but if your background is a plane gameObject:
the height is always the same, only manually drag the camera to look exactly at the top and botton corners
but… the width is variable, you need or to resize the plane(as a child of the camera) in x-axis using a simple count:
place a object at the top of the plane, and one at the botton;
one at left and one at right.
`#pragma strict
var top : GameObject;
var bottom : GameObject;
var left :GameObject;
var right : GameObject;
var height : float;
var width : float;
var planewidth : float;
function Start () {
top = GameObject.Find(“top”).gameObject;
bottom = GameObject.Find(“bottom”).gameObject;
left = GameObject.Find(“left”).gameObject;
right = GameObject.Find(“right”).gameObject;
height = (top.transform.position - bottom.transform.position).y;
planewidth = (left.transform.position - right.transform.position).x;
width = (Screen.width*height)/Screen.height;
transform.localScale.x = planewidth/width;
}
function Update () {
height = (top.transform.position - bottom.transform.position).y;
width = (Screen.width*height)/Screen.height;
planewidth = (left.transform.position - right.transform.position).x;
transform.localScale.x = width/planewidth;
}`