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 COLLAnitySV · Nov 04, 2011 at 02:20 PM · booleandisableintconvertmain menu

Turn Off int using Boolean

Hello Everyone, sorry i'm always ask a question in unityanswers

Why does everytime i want to turn off the int using boolean, debug says "cannot convert int to boolean". How do i turn off the int? it's so annoying

and this is the example of my script currentMenuItem is Int, and menuToggle is Bool

 function Update (){
         
         if(!menuToggle){
             menuItems[currentMenuItem].OnSelected(false);
             if(settingsToggle){
                 currentMenuItem = 3; //i've got Array index is out of range.
             }
     
         }
     
         if(!settingsToggle){
             menuItemz[currentMenuItemz].OnSelected(false);
         }
     
     }

and this is the video http://www.youtube.com/watch?v=2MqQOhmns-Y

thank you very much for the reply. I really need this

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 syclamoth · Nov 04, 2011 at 02:47 PM

Well, if you're trying to convert a number into a 'true or false' value, that's going to happen. I'm afraid from your code, it's not especially clear what's going on here! I con't know what menuItems is, or where exactly you are trying to do what you are trying to do.

The 'Array index out of range' exception happens if you try to access a variable which is either smaller than zero, or greater than the highest index in the array. An array is indexed from 0 - (size - 1)- if your array is 3 long, the first one will be indexed '0', and the last one will be indexed '2'. It's possible that this is what is confusing you here.

I'm afraid that video you posted along with the question sheds absolutely no light on what the problem might be.

Basically, you can't 'deactivate' an int. What are you trying to do, stop the number from existing? That does't really make any sense. I'm sure what you're trying to do is possible, but the method you are chasing here is a dead end. Please explain yourself a bit better, and I'm sure someone'll be able to help you find a better way.

Comment
Add comment · Show 1 · 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 COLLAnitySV · Nov 05, 2011 at 08:43 AM 0
Share

thanks for the answer. :) menuItems is the array of menuTem and menuTem is the script of iTween this is the full script. http://answers.unity3d.com/questions/180458/3d-main-menu-problem.html now what i'm going to do is stop the main menu action while i'm pressing or on settings area, then when i press return (settings area) the settings area should stop moving, then the main menu back. as you can see on my video, main menu and settings are moving together. you know what i mean right <:)

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

Turn float to int 2 Answers

[SOLVED] Convert this line from string to int 1 Answer

Get the number of false bools in GameObject[] (array) 3 Answers

js "Cannot convert 'String' to 'int'." error 1 Answer

Cannot implicitly convert type `float' to `int'. An explicit conversion exists (are you missing a cast?) 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