Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by blitzen · Oct 16, 2011 at 03:04 AM · copyguistyledefaulttweakgui.skin

How to Edit a Copy of the Default Skin

For cases where I want to use most of the settings from Unity's default skin, but just tweak a thing or two and only for one element at a time (say, a button), I'm attempting to create a copy of a style from the default skin and then just edit that copy. Since the docs say that the constructor for GUIStyle can take as an argument another style which it will construct a new copy of, I tried using that:

var myStyle:GUIStyle=GUIStyle(GUI.skin.button);

However, myStyle does not seem to have been filled out; it's all blank as if I hadn't called the constructor. I've further tried assigning it directly:

var myStyle:GUIStyle=GUI.skin.button;

This now seems to make myStyle into a pointer of sorts, so that any changes I make to myStyle are actually applied directly to GUI.skin.button and affect all other buttons in the game. (Not only that, it seems to leave the default skin this way permanently, so that I can't seem to retrieve the factory-settings even by calling "GUI.skin=null;".

So how might one make a small tweak to the default GUI.skin, for only one particular GUIContent?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by syclamoth · Oct 16, 2011 at 03:10 AM

Try downloading this- it gives you all the assets in the default skin, which allows you to swap and change the ones you need with ease! Then, just use that skin for everything instead of the default one.

Also, it's funny that using the GUIStyle constructor in the way you mentioned there didn't work, since the documentation claims it should work the way you think it should. Can someone confirm how the usage of the 'new' keyword in javascript relates to this kind of thing? I'm a C# person normally, so I'm not too familiar with the ins and outs of javascript programming.

Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image blitzen · Oct 16, 2011 at 04:38 AM 0
Share

I've actually downloaded that before. The "BuiltinSkin.unitypackage" file seems to contain only 2 files, the first being a font ("Arial Rounded Bold.ttf") which yields the error:

The font Assets/Builtin skin/Sources/Arial Rounded Bold.ttf could not be imported because the file is empty. If the file comes from $$anonymous$$ac OS X, it might be that all data is in 'resource fork'. Change the file there to have data in the file.

The other file is the script "ShowSkin.cs", which merely displays for you the various styles of your current skin. It doesn't seem to reset GUI.skin for you, or contain any actual style information.

avatar image syclamoth · Oct 16, 2011 at 04:56 AM 0
Share

um, that's weird. That's not what I remember being in the package! Are you sure you are talking about the same thing? The package I'm talking about has all the assets of the default skin in it!

avatar image blitzen · Oct 16, 2011 at 04:16 PM 0
Share

Since this post I've re-downloaded it twice to double-check. It's nothing but those 2 files, and the zip file underneath it on that page contains a .psd file with the GUI textures all placed together, but still no actual GUISkin data.

It's really a secondary issue, though, as the page says itself you don't need the files since the information is buit-in. Even if it had the assets, I'm still disturbed by the original two problems:

    The GUIStyle constructor not working as per the docs, leaving me wondering how to copy a style (or skin). Unity permanently keeping my modifications to the default skin in the project, leaving me unable to retrieve the factory settings even with
GUI.skin=null; Can someone confirm the above facts by testing it themselves?
avatar image Demigiant · Dec 02, 2011 at 11:04 AM 0
Share

I'm just having the same issue, though only with custom skins. If I use a custom GUISkin and create a new style for, like, a button, all the buttons in any component using UnityGUI are changed. This is terrible...

avatar image Demigiant · Dec 02, 2011 at 11:11 AM 1
Share

Uh, found the reason (that was quick :P). Actually, the first time I created the new GUIStyle I erroneously used

GUIStyle buttonStyle = GUI.skin.button;

I immediately realized my mistake, and I corrected it with

GUIStyle buttonStyle = new GUIStyle( GUI.skin.button );

but I had already run the player once with that wrong setting, and I just discovered that it changes the actual GUISkin settings in your project! Wow! Bad! I had to reset them manually and now everything's working.

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Accessing default resources 1 Answer

TextField moves/jumps when focused 0 Answers

Scene view camera reverts to defaults when another window is minimized 1 Answer

subclass default values in list 2 Answers

How to get or set selected QualitySetting for specific platform 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges