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 kwelts · Jun 19, 2012 at 10:12 PM · uinguihide

NGUI panel wont hide

I have a script that tries to hide a panel when a button is clicked.

 using UnityEngine;
 using System.Collections;
 
 public class HideTopPanel : MonoBehaviour {
     
     public enum Trigger
 {
 OnClick,
     }
     
     public GameObject uiObject;
     public Trigger trigger = Trigger.OnClick;
     
     void Start () {
         // assign GameObject
         uiObject = GameObject.Find("PanelTop");
         // uiObject.SetActiveRecursively(true);
         
     }
     
     void OnClick() {
         if (enabled && trigger == Trigger.OnClick) {
     //disable viewing the object using SetActiveRecursively()
             //uiObject.SetActiveRecursively(false);
     // OR
             //NGUITools.SetActive(uiObject, false);
     // OR        
             //NGUITools.SetActive(GameObject.Find("PanelTop") as GameObject, false);
     // OR    
             // uiObject.renderer.enabled = false;
         }
     }
 }

ive commented out all my attempts to hide the panel so you can still see all the ones i've tried. They all do the same thing which is grey out the panel and it's children in the hierarchy pane, but nothing changes visually in game. I have the latest Unity and NGUI installed on my computer.

Is there anything I am missing? Any help to visually hide the entire panel would be much appreciated.

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 whydoidoit · Jun 19, 2012 at 10:17 PM 0
Share

$$anonymous$$ight be a good idea to post the NGUI forum. The developer is very responsive.

avatar image Linus · Jul 24, 2012 at 03:08 AM 0
Share

uiObject.SetActiveRecursively(false) should do the job.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by mindlube · Jul 24, 2012 at 03:40 AM

There is a NGUITools.SetActive() which was added as a workaround for SetActiveRecursively "rare odd issues" according to the ngui developer! maybe try that, or as suggested, ngui forums FTW :)

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
avatar image
0

Answer by Russel · Jul 30, 2012 at 03:15 PM

GetComponent could help you ;)

UIPanel uiObject = GameObject.Find ("PanelTop").GetComponent (); uiObject.gameObject.SetActiveRecursively(false);

Comment
Add comment · Show 4 · 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 sona.viswam · Feb 07, 2013 at 05:54 AM 0
Share
 Got error "Cannot implicitly convert type `UnityEngine.GameObject' to `UIPanel'"
 i can give false option like below code
 GameObject panel1  = GameObject.Find("firstPanel");    
 NGUITools.SetActive(panel1,false);    
 After taht i cant able to make true.
avatar image Russel · Feb 07, 2013 at 09:36 AM 0
Share

Sorry, That should work.

UIPanel uiObject = GameObject.Find ("PanelTop").GetComponent < UIPanel > (); uiObject.gameObject.SetActiveRecursively(false);

avatar image sona.viswam · Feb 07, 2013 at 10:14 AM 0
Share

In which script u added that codes.

avatar image Russel · Feb 07, 2013 at 11:07 AM 0
Share

In a own new script for example, which will be attached to any GameObject.

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

8 People are following this question.

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

Related Questions

NGUI elements are being shown as black area on iPhone4 and iPod4 1 Answer

ngui tween in fixedupdate or update 1 Answer

Problem with NGUI component rendering? 0 Answers

Invalid rank specifier error 0 Answers

NGUI Mouse position doesn't match with dragged object 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