- Home /
Window Background Image not showing
Hello everyone
Im trying to add an image to my window(so its the window background)
I've added the image to the skin.
And I've called this:
GUI.Skin = mySkin;
_windowRect = GUI.Window (THE_WINDOW_ID, _theWindoRect, theWindow, "Title for Window", "added_Image");
For some reason, the image isn't appearing.
The dimensions for the window are the same as the image and its .png. (added_Image is the title I gave it on mySkin)
I've also set the image to GUI...What am I missing?
Thanks for your time.
Answer by zharik86 · Jul 08, 2014 at 07:04 AM
If you see the text, means shall be and bachground. First, there is no GUI.Skin method, and there is GUI.skin. Secondly, it is necessary to add background in your Style in the section normal. Also check initial transparency of a texture. Check that it has parameters border, margins and others were equal 0. Also don't forget to add in a script the reference to your Skin. If applied Style isn't present in the current Skin, Unity will write to console Warning: repaint. I hope it to you will help.
I've changed to GUI.skin, I've added the background to the custom style in the normal selection. I've set the image to GUI, I've got nothing on my dbg and I've checked everything is set to 0.
As I understood, helped nothing. Then it isn't clear in what there can be an error. Try to add your texture in public variables in your script. Also look, whether it will be shown by means of the function DrawTexture():
public GUISkin mySkin = null;
public Texture2D myTex = null;
void OnGUI() {
GUI.skin = mySkin;
GUI.DrawTexture(new Rect(10, 10, 60, 60), myTex, Scale$$anonymous$$ode.StretchToFill);
}
It will be so clear as Unity perceives a texture
And check in your style method "Image Position": it's sets how "ImageLeft".
Your answer
Follow this Question
Related Questions
JavaScript GUI.Window OverPowers GUI.Button 1 Answer
Using custom style for window rect? 0 Answers
picture in picture 3d. 0 Answers