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?
3 ответов
+ 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"
+ 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