How do i yield code using double and not float? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do i yield code using double and not float?

So i am working on some sort of game... and when i was making a typewriter effect for dialog,you know like where every char appears one by one, i wanted to yield it for 0.5 it said that what i used only accepts floats. Do you know a way where you can yield using doubles?

3rd May 2023, 4:10 PM
Brushymilbil
Brushymilbil - avatar
2 Answers
+ 6
// convert double to float: double x = 1.23456789; float y = (float)x; // if you define the float: float z = 1.23f; // don't forget the "f"
3rd May 2023, 5:55 PM
Lisa
Lisa - avatar
+ 1
type conversations aside, yield return is type agnostic, so your problem isn't with yield. Probably you specified somewhere else in the code that the returned value needs to be a float
3rd May 2023, 7:51 PM
Orin Cook
Orin Cook - avatar