Hi there. I’m wanting my PC game to have multiple resolutions so that when the user chooses their resolution, an image made specifically for that particular resolution will be displayed on the screen as the main background 2D image.
At the moment I have my images within the resources folder and am accessing the images as a www file type.
I have put this script on to a Cube gameobject so far and it does display by accessing the renderer, but of course if I change the image to a different resolution type it doesn’t really make a difference with alignment. This is where I don’t know where to go, because I’m not sure which Gameobject type I should use for what I’m trying to do (stick to the cube, empty gameobject with shader and renderer? A plane? A quad?). Is there a type of gameobject to easily load up the image and display correctly to the resolution in relation to the main camera, or a simple script to do this?
Here is my script for accessing the image and it being placed on the cube:
using UnityEngine;
using System.Collections;
publicclassImageBackground:MonoBehaviour
{
publicTexture2DscreenImage;
SpriteRendererrend;
publicWWWpullImage;
voidStart()
{
rend=GetComponent();
screenImage=newTexture2D(128,128);
Rendererrenderer=GetComponent();
renderer.material.mainTexture=screenImage;
screenImageShow();
}
voidscreenImageShow()
{
pullImage=newWWW(“file://”+Application.dataPath+“/Resources/ScreenImage.png”);
pullImage.LoadImageIntoTexture(screenImage);
}
}
I have been searching for a while now for solutions to this problem, and there are solutions, but I don’t know how to implement them properly because my circumstances are slightly different and can’t work out how to alter the code.
I am new to programming so any help will be greatly appreciated.
Thanks
Runtyboy