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
0
Question by CyberArtist · Aug 21, 2014 at 06:50 PM · javascriptguiskin

Unable to find style 'HUD Button' in skin

I'm following javascript from a book on GUI. I have the correct code for the GUI Skin. Yet I'm getting like "Unable to find style 'HUD Button' in skin 'GameSkin' mouseUp. What is it I need to change in my code or the asset inspector?

 var customSkin : GUISkin;



 //Display------------------------------------------
 function OnGUI()
 {
     if(customSkin)
         GUI.skin = customSkin;
     
     //Moalia's vitals
     customControls.LeftStatusMeter(MoaliaImage, playerInfo.health, playerInfo.stamina, lbarImage, lhbar, lsbar);
 
     //Non-usable inventory buttons--------------------------
     customControls.InvoHudButton(Rect(Screen.width - 210, Screen.height - 100, 93, 95), playerInvo.GetItemCount(InventoryItem.STAMINA_INJECTOR), staminaInjectorImage, "Avalable Stamina Injectors in inventory.");
 }

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 Cherno · Aug 21, 2014 at 07:10 PM

In your project folder, find the GUISkin customSkin file, and open it with the inspector. check the custom styles. If there isn't a custom style with the name of "HUD Button", create one.

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 CyberArtist · Aug 21, 2014 at 07:59 PM 0
Share

Did that and it solves nothing. alt text

guisp1.jpg (54.7 kB)
avatar image Cherno · Aug 21, 2014 at 08:03 PM 0
Share

And you are sure that this GUIskin get used for your OnGUI()? In the inspector, check if the customSkin variable shows the skin that has the HUD Button custom style.

avatar image CyberArtist · Aug 21, 2014 at 08:27 PM 0
Share

How? I'm getting confused.

And from what the error says: "Unable to find style 'HUD Button' in skin 'GameSkin' Layout UnityEngine.GUIStyle:op_Implicit(String) GUI_CustomControls:InvoHudButton(Rect, Int32, Texture, String) (at Assets/Scripts/GUI/GUI_CustomControls.js:7) GUI_HUD:OnGUI() (at Assets/Scripts/GUI/GUI_HUD.js:41)"

Does this line have to do with the error:

     customControls.InvoHudButton(Rect(Screen.width - 210, Screen.height - 100, 93, 95), playerInvo.GetItemCount(InventoryItem.STA$$anonymous$$INA_INJECTOR), sta$$anonymous$$aInjectorImage, "Avalable Sta$$anonymous$$a Injectors in inventory.");

avatar image Cherno · Aug 21, 2014 at 09:13 PM 0
Share

I don't think so.. Let's do it all again.

  1. Create a new GUISkin.

  2. Inside that GUISkin, create a custom GUI Style with the name "HUD Button".

  3. In the script, declare a variable

    public GUISkin skin;

  4. Drag the GUI Skin you created from your project folder to the field of the skin variable of the script.

  5. in the script, at the start of the OnGUI() function, insert the line

    GUI.skin = skin;

That should be all.

avatar image Cherno · Aug 21, 2014 at 09:51 PM 0
Share
  public var skin : GUISkin;
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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Setting Scroll View Width GUILayout 1 Answer

Possible Bug in Unity 4.0.0f7 ? GUISkinn selection Need Help! 2 Answers

Can someone help me fix my Javascript for Flickering Light? 6 Answers

GUISkin Problem 1 Answer

Assign myGUISkin in javascript 3 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