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 TheMiziko · May 09, 2013 at 06:21 PM · guifindstyleto

Unable to find style 'Close Window Button' in skin 'ChestSkin' Repaint

Hi ! when I open my chest in game i had this error with GUI :

 Unable to find style 'Close Window Button' in skin 'ChestSkin' Repaint

Here is all code for chest:

 using UnityEngine;
 using System.Collections;
 using System.Collections.Generic;
 
 public class MyGUI : MonoBehaviour {
     public GUISkin MySkin;
     
     public float lootWindowHeight = 90;
     
     public float buttonWidth = 40;
     public float buttonHeight = 40;
     public float closeButtonWidth = 20;
     public float closeButtonHeight= 20;
     
     
     private bool _displayLootWindow = false;
     private float _offset = 10;
     private const int LOOT_WINDOW_ID = 0;
     private Rect _lootWindowRect = new Rect(0,0,0,0);
     private Vector2 _lootWindowSlider = Vector2.zero;
     public static Chest chest;
 
     // Use this for initialization
     void Start () {
     }
     
     private void OnEnable() {
         Messenger.AddListener("DisplayLoot", DisplayLoot);
         Messenger.AddListener("CloseChest", ClearWindow);
     }
     
     private void OnDisable() {
         Messenger.RemoveListener("DisplayLoot", DisplayLoot);
         Messenger.RemoveListener("CloseChest", ClearWindow);
     }
     
     // Update is called once per frame
     void Update () {
     
     }
     
     void OnGUI() {
         GUI.skin = MySkin;
         
         if(_displayLootWindow)
             _lootWindowRect = GUI.Window(LOOT_WINDOW_ID, new Rect(_offset, Screen.height - (_offset + lootWindowHeight), Screen.width - (_offset * 2), lootWindowHeight), LootWindow, "Loot Window", "box"); 
     }
     
     private void LootWindow(int id) {
         GUI.skin = MySkin;
         
         if(GUI.Button(new Rect(_lootWindowRect.width - _offset * 2, 0, closeButtonWidth, closeButtonHeight), "x", "Close Window Button"))        
             ClearWindow();
         
         if(chest == null)
             return;
         
         _lootWindowSlider = GUI.BeginScrollView(new Rect(_offset * .5f, 15, _lootWindowRect.width - _offset, 70), _lootWindowSlider, new Rect(0, 0, (chest.loot.Count * buttonWidth) + _offset, buttonHeight + _offset));
         
         for(int cnt = 0; cnt < chest.loot.Count; cnt++) {
             if(GUI.Button(new Rect(_offset * .5f + (buttonWidth * cnt), _offset, buttonWidth, buttonHeight), chest.loot[cnt].Name)) {
                 chest.loot.RemoveAt(cnt);
             }            
         }
         
         GUI.EndScrollView();
     }
     
     private void DisplayLoot() {
         _displayLootWindow = true;
     }
     
     private void ClearWindow() {
         _displayLootWindow = false;
         
         chest.OnMouseUp();
         
         chest = null;
     }
 }
 

Comment
Add comment · Show 2
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 TheMiziko · May 10, 2013 at 10:38 AM 0
Share

Right, I added a new style to my GUI and everything works :)Thanks :D

avatar image ExTheSea · May 10, 2013 at 10:42 AM 0
Share

I converted my comment to a question so that you can accept it to mark the question as solved.

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by ExTheSea · May 10, 2013 at 09:58 AM

Do you have a style called Close Window Button in the GUISkin you use?

Comment
Add comment · 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

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

14 People are following this question.

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

Related Questions

GUI Button Skin Design 1 Answer

Multiplying Integer value to transform.localScaleY position 1 Answer

what if i cannot find the start using unity button? 1 Answer

Copy the Default Style 1 Answer

Defualt GUI Style 1 Answer


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