- Home /
Script error CS0029: Cannot implicitly convert type `float' to `bool'
Hello everyone! on my project I get this error in this script.
CharacterController2D.cs (332.23): error CS0029: Can not implicitly convert type float 'to
bool' I enclose a picture. How could I solve this problem?
Answer by tanoshimi · Mar 21, 2015 at 08:30 PM
The error is telling you that State.SlopeAngle
is a bool. And you're trying to assign it angle
, which is a float.
Thanks for the reply tanoshimi. How can I solve the problem between float and bool?
That's a bit like saying "how do you solve the problem of putting a square peg in a round hole"? You don't; you use a round peg, or find a square hole...
Its kind of like "What colour is a triangle?". A bool is a true or false value. A float is a number.
You can convert a float to a bool by comparing it with some other float. This may or may not make sense in the context of your logic.
Your answer
![](https://koobas.hobune.stream/wayback/20220613190848im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
All Charater controllers not working, (Same issue). 0 Answers
Character Flying around uncontrollably 2 Answers
Enemy Character Controller 1 Answer
Mecanim and Child Objects 0 Answers
My Character Doesn't Move Properly 0 Answers