Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrad Bittner
724 PointsI was expecting float rather than double, now I'm wondering if I've been using float incorrectly all this time
Pretty self explanatory, I'm simply curious what the differences in data type (or rather the application of them) are between float and double. Embarassingly, I had never even heard of "double" before and I've been developing in Unity for some time, and never gave much thought to what float is, I just always knew it as "the type you need when you're using decimals" haha
2 Answers
markmneimneh
14,132 PointsHello
please take a look here: https://www.tutorialspoint.com/csharp/csharp_data_types.htm
but in summary, double takes a much larger memory than float.
Michael Zdarsky
4,533 PointsDoubles have a higher precision, but unity and your GPU typically deal with floats. I would stick with floats, until you are required to use a double, just for the sake of performance and changing variable types..