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 thenachotech1113 · Jun 17, 2012 at 01:56 PM · variablehowbooleans

what is a boolean

I am a noob in Unity and I`ve been watching youtube tutorials and I have noticed some people use variables of tipe boolean and I can`t find out why.

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 Fattie · Jun 17, 2012 at 02:31 PM 0
Share

it means true or false

3 Replies

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

Answer by slayer29179 · Jun 17, 2012 at 02:06 PM

Boolean is a variable which can go two ways on or off :) so you can use it for switches, to enable something or detect items such as if the player hits a location the variable switch is true and if its true do something else it usually looks like so

 var <variable name> = true ;
 var <variable name> = false;

:) to detect them

 if (<variable name> == true) 

 

note: two equal signs to say if and 1 equal sign to say it does hope this helps :)

Comment
Add comment · Show 2 · 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 thenachotech1113 · Jun 17, 2012 at 02:30 PM 0
Share

cool thanks

avatar image Wolfram · Jun 22, 2012 at 12:09 AM 1
Share

For reference, this type is called "bool" when using C# ins$$anonymous$$d of UnityScript.

avatar image
4

Answer by Drakestar · Jun 17, 2012 at 02:06 PM

A boolean has 2 values: 0/1, or true/false. It's the simplest state that a computer can represent, and corresponds to "energy is flowing/is not flowing" (all computers are built around boolean logic). Theoretically, a BOOL can be represented in memory using a single bit, but for various reasons (ease of memory addressing and speed) it's usually 1 byte.

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 thenachotech1113 · Jun 21, 2012 at 11:59 PM 0
Share

awesome thanks for the patience, as you can see im kind of a noob

avatar image
0

Answer by QuarterMillion · Aug 16, 2021 at 09:18 PM

@Drakestar I feel like that is so backwards if something returns a value it should be true and its numerical representation should be 1.

If something does not return a value it should be false and its numerical representation should be 0 as no value was returned and it would line up more naturally with what you'd expect.

I propose this :

 bool[] realbool = new bool[]{false,true};

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 rage_co · Aug 17, 2021 at 07:45 AM 0
Share

yeah, i think he didn't put that much thought in order, 1 is true and 0 is false, but i guess it's a 9 year old post...so not that it will matter as much

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

Unity says there is no such thing as a boolean. 1 Answer

void cannot be used in a boolean context 1 Answer

Static variable error 2 Answers

Why can't I acces my global variable? 3 Answers

Played time? 2 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