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 BilboStabbins · Jan 14, 2013 at 01:23 AM · stateezgui

EZGUI - Changing UIButton states from another script

Hi guys,

I am an EZGUI/SM2 newbie and am trying to port my title screen menu system to utilize these. I have a TV screen which begins by displaying a non-interactive/clickable animated texture which after a few seconds displays a different animated texture that can be clicked. After it has been clicked, it moves to a third texture which is again non-clickable. However, if it is not clicked it will move onto a different third texture. For this purpose the UIButton control with its various states seems ideal and I have managed to create the animated textures and add them to the UIButton component successfully.

The process goes like this:

If Texture_2 not clicked:

 non-clickable --------------> clickable ----------------> non-clickable
 Texture_1 ----------------> Texture_2 ----------------> Texture_3



If Texture_2 clicked:

 non-clickable --------------> clickable ----------------> non-clickable
 Texture_1 ----------------> Texture_2 ----------------> Texture_4


However, I am unsure of how to manipulate the button states in script. For example, I have set my 'Disabled' texture in the UIButton component in the Inspector, but when does this disabled time come into play? Also, as there are 2 different ways to go (if clicked or not) after Texture_2, how might I go about describing this from another script?

Any guidance on this would be great. Thanks

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
Best Answer

Answer by robertbu · Jan 14, 2013 at 05:02 AM

I've done some work with EZGUI, but I by no means an expert. What I think you want to use to implement your "button" is a State Toggle Button (UIStateToggleBtn) rather than a UIButton. It is described as, "The State Toggle Button control type works much like a traditional checkbox/toggle button, except that it supports an arbitrary number of states. It will advance incrementally from one state to the next every time it is clicked/tapped, and upon reaching the last state, if clicked/tapped again, it will return to the first state and start over."

Typically I access the class by adding my own script to the game object that has the button and then doing something like:

 UIStateToggleBtn ustb = GetComponent<UIStateToggleBtn>();

The class has a SetState() method, so you might be able to just reset the state to the current one on a click if it should be disabled. But if not you can use one or more of SetInputDelegate() AddInputDelegate() SetValueChangeDelegate() and AddValueChangeDelegate() to implement your disabled state. Or you can subclass UIStateToggleBtn class and override the SetState method.

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

9 People are following this question.

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

Related Questions

EZGui and previous state 0 Answers

EZGUI / SM2 - Each UIButton state as an animated texture 1 Answer

change model state due to health 1 Answer

The animation state right could not be played because it couldn't be found! 0 Answers

Controlling Animator through Script. I'm stuck please help! 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