- Home /
how to use the default skin in a custom stlye?
I added a custom stlye to my GUISkin and want to use the default button background for it. However, I don´t see how to select it.
The "Button" style in that Skin uses the background of the default unity skin (button).
My custom stlye has currently "none". When I open the "Select Texture2D" Window, I see all my own textures in the list, but not the unity default texture.
There is no way to drag and drop it, or copy and paste it. How do I get it into my custom style?
I'm not entirely sure what you're asking...but I think what you want to do is download the default Unity GUI skin (I'm pretty sure it's on the Asset Store) and use the button texture from it.
The point is that those textures are there already since the standard buttons use them. So why can I not use them for any custom styles that I add? All I would need is to be able to select them.
I made now my own texture. This is overhead but what ever...
THX anyway for your help.
Yes, those textures are there already, but they are...built in. If you want to use them, you'll have to download them and then put them in your project, and then you will have a duplicate set of the textures, which will not be built in and you can use them. Simple.
When you create a skin it starts with all the defaults, just don't change them
Answer by AllenKashiwa · Sep 29, 2016 at 10:35 PM
@antx I can't find a way in editor. But you can try this in code:
GUIStyle customStyle = GUI.skin.GetStyle("custom");
customStyle.normal.background = (Texture2D)Resources.GetBuiltinResource(typeof(Texture2D), "GameSkin/window.png");
customStyle.onNormal.background = (Texture2D)Resources.GetBuiltinResource(typeof(Texture2D), "GameSkin/window on.png");
code above is for window. You can change button style the same way:
gUISkin.button.normal.background = (Texture2D)Resources.GetBuiltinResource(typeof(Texture2D), "GameSkin/button.png");
gUISkin.button.hover.background = (Texture2D)Resources.GetBuiltinResource(typeof(Texture2D), "GameSkin/button hover.png");
Answer by TriaDev · Dec 22, 2021 at 11:32 PM
hey @antx I hate to rez a very old thread, but the solution is simple and might help someone. Just copy the image from the skin style you want and paste it into the skin style you want to replace. Example: to put back the original button normal background image 1) create a new skin. 2) open the button style fold out. 3) right click in the normal background image field and select copy. 4) go to your other skin (where you want the to replace the button image). 5) in that skin's button normal background image field, right click and paste. cheers
Your answer
Follow this Question
Related Questions
Can't change button GUIStyle background. 1 Answer
GUI Button + GUISkin = Bug, Help? 1 Answer
Make variable to select scene? 2 Answers
Click anywhere to deselect active GameObject 3 Answers
How to Choose a character.characters before game start 0 Answers