- Home /
Unity says there is no such thing as a boolean.
Here is the line of code in question, it says there is an error.
boolean isGrounded = true;
Answer by SkaredCreations · Dec 18, 2014 at 01:19 AM
If you're using JS it's
var isGrounded : boolean = true;
If it's CS:
bool isGrounded = true;
So as usual Unity is right. There is no such thing as a Boolean as you have described it.
bool is the keyword most languages use, the same way Integer is almost always int.
Actually there is, but nobody would use the underlying type name. $$anonymous$$ost .NET languages have alias names for those primitive types. Like:
string = System.String
bool = System.Boolean
int = System.Int32
object = System.Object
//enum = System.Enum // not a real alias since it's actually a keyword.
In UnityScript the alias for System.String is String
See this list for more details.
I'm so going to use System.Int32 somewhere. I guess it makes sense, now I see it. But I'd never thought that the primitives actually had to have definitions somewhere too.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Hiding OnGUI? 1 Answer
void cannot be used in a boolean context 1 Answer
if several variables is true then do function 2 Answers
farming game with replanting problem 2 Answers