- Home /
InvokeRepeating on object with DontDestroyOnLoad
I'm having an issue where I have a method that is invoked using InvokeRepeating, and whenever I change scenes the entire thing locks up. I've found that this is because within that repeating method I'm reading from a stream using ReadLine, which waits for the end of the line before proceeding. However, When I load my new scene it seems that the main thread takes over because the game locks up until I send that stream input, and which point it unlocks and then immediately locks back up waiting for more input.
Any suggestions on how to fix this?..
I've already tried flushing the stream, closing the stream, and canceling the Invoke on the MonoBehaviours Awake method and then re-invoking it. I've also tried doing the same in the OnLevelWasLoaded method.
Your answer
Follow this Question
Related Questions
Next LEVEL Load Problem. 2 Answers
DontDestroyOnLoad alternative? 2 Answers
Scene not loading properly everytime 3 Answers
undoing DontDestroyOnLoad without immediately destroying the object 4 Answers