Torch Script Error - Unity crashes

Hello,

I’m trying to write a Torch Script for my game im working on.
Everytime I’m loading it into Unity my program crashes.

Do someone could help me out please?

regards,

Soul

You really don’t want to use Thread.Sleep in Update; all scripts in Unity run in a single thread. Instead of Update, use coroutines (which will also get rid of most of the spaghetti code). Also, instead of trying to use ints and constant time values, use floats and Time.deltaTime. This way values change every frame, instead of in chunks, which will look smoother. Edit: and what Bunny83 said in the comments about the infinite loop is what’s actually causing the crash. :slight_smile: