- Home /
How do I get an image to fullscreen?
I have attached this to my main camera but I am still not getting full screen. public class DooDoo : MonoBehaviour {
public Texture backgroundTexture;
void onGUI(){
GUI.DrawTexture (new Rect (0, 0, Screen.width, Screen.height), backgroundTexture);
}
}
Answer by zharik86 · Jun 11, 2014 at 06:27 AM
Adding ScaleMode in your code in function GUI.DrawTexture():
public Texture backgroundTexture;
void onGUI(){
GUI.DrawTexture (new Rect (0, 0, Screen.width, Screen.height), backgroundTexture, ScaleMode.StretchToFill);
}
Thank You. It stretched the image but there is some blue screen left over.
why don't you use a plane's face and resize visually on game's tab?
@djbeatzzz About "blue screen left over" - it is possible at you a texture with the edge the transparent therefore (as I assume color in the camera blue) and it is visible partially blue color. The second: "image is blurry" - try to change in the Inspector of properties of import of a texture Type value to "GUI". Probably it will help. But don't forget that if you have a texture of 100x100 in size, and you expand it on 500x500, certainly it will look blurry.
Answer by Xonatron · Nov 22, 2017 at 03:49 AM
Heads up it's OnGUI() not onGUI(). Note the capital "O".
Your answer
Follow this Question
Related Questions
Colour of borders after build full screen 0 Answers
Setting Resolutions in game/checking windowed mode 1 Answer
How to Eliminate Monitor Artifacts When Loading Scene? 1 Answer
Is it possible to change between exclusive fullscreen and borderless fullscreen in-game? 2 Answers
Unity Player Crashes ONLY on Firefox after migration 0 Answers