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
1
Question by jni97 · Jun 22, 2015 at 03:40 PM · c#uicanvasalphainvisible

How to hide Canvas?

Hi, I made an Inventory System. The problem is that if I write "Canvas.SetActive(false);", I can't use the Script on it. But I have to use the attached script.

I think instead of setting the SetActive state to false, I have to change the alpha channel of the canvas.

How can I change this?(I'm using the new UI)

Thanks for help!

Comment
Add comment · Show 1
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 lloladin · Jun 23, 2015 at 10:09 AM 0
Share

do you want to hide the inventory when button clicked?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Flightkick · Jun 23, 2015 at 10:20 AM

If I understand you correctly you have a canvas in which you display your inventory and you want to be able to hide/show this inventory.

To be able to achieve this it might be worth adding your inventory objects to an empty gameobject which you name Inventory (see pic).

Screenshot

You can then toggle this GameObject via SetActive()

Example (whereas Inventory is a the empty gameobject where your inventory items reside in):

         private void ToggleInventory()
         {
             Inventory.SetActive(!Inventory.activeSelf);
         }



canvas.jpg (3.4 kB)
Comment
Add comment · Show 3 · 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 jni97 · Jun 23, 2015 at 11:08 AM 0
Share

The problem that the Inventory has a script. And I have to have access to the script even the Inventory is not active...

So your method dont work

avatar image blizzy · Jun 23, 2015 at 11:41 AM 0
Share

You can also just disable the Canvas component.

avatar image jni97 · Jun 23, 2015 at 04:35 PM 0
Share

I think you didnt understand my problem...I can't deactivate the canvas or the Inventory becaus the Inventory has a Script. Another Script has to use the Inventoryscript even when the inventory is deactivated. So I have to hide it without deactivate it... How can I do this?

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

Renderer on object disabled after level reload 1 Answer

How to change the alpha of the whole canvas? 1 Answer

CanvasGroup.alpha hides the UI in Scene view but not in game view. 1 Answer

turn off interactable without changing alpha 0 Answers

How can i make this script work in a "loop"? 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