Quantcast
Channel: Questions in topic: "loops"
Viewing all articles
Browse latest Browse all 184

Loops without coroutine [SOLVED]

$
0
0
Hii, i need to create a simple loop but without using coroutine we can easily do that outside of unity but as far as i know in unity you must use IEnumerator to do this but that means i need an instance and coroutines does not return values without use of callbacks which i can't use since i need the whole loop not the callback from the start or end ---------- So in unity i did something like in this example but the loop only runs for one frame and then stop which is weird since when you start an loop it should run until reach the ends or freeze the whole machine if there's no end so how can i do a loop without using coroutines? ---------- public void Stuff() { float value02 = SimpleLoop(); } public float SimpleLoop() { float value = 0f; while (value < 10f) { value++; return value; } return value; } I'm trying to have my own Lerp functions running through a Utility class like plugins as DoTween where you just need to call the function and not implement the whole code behind it that's why i'm trying to do such thing but if there's another way to do it i would appreciate if someone could guide me. ---------- Cheers.

Viewing all articles
Browse latest Browse all 184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>