- Home /
StackOverflow error
Hey, I had seen a tutorial how I can add TouchControl to my app. My problem is if I add the script and press Play it doesn't works.
The error message is: StackOverflowException: The requested operation caused a stack overflow. Swipe.GetSwipeDelta () (at Assets/Swipe.cs:98)
The Code line 97 and 98:
97 public Vector2 GetSwipeDelta()
98 { return GetSwipeDelta(); }
Answer by donutLaserDev · Jul 03, 2018 at 11:08 AM
Do you really not see the problem here? You have a method which calls itself, which causes an infinite loop and stack overflow. Method's address is put on the stack each time the method is called. Since the method doesn't ever exit, the addresses are put on the stack until there's no more space left on it. That's what stack overflow means.
It might be that you meant to call another method instead of GetSwipeDelta ().
wowwwww I am dumb, I was editing some code in a coroutine and took out a yield return new WaitUntil() statement, which had the program calling said coroutine right after