Relative Content

Tag Archive for c#unity-game-enginecoroutine

Unity Coroutine closes all the threads and the debugger turns off

I am writing a visual novel and i have a problem with saving my data. When i save the data in a savefile and then change the script, the old script remains. Like i told my character to move left, then i saved the game and then i saw that it would be better to make him move right, i change it in the script, load the save, but he is still standing left. i decided to use FileSystemWatcher to activate an event while I change the script and the reload manually the script in all the saves. I have no idea how to do this, but I think I need a coroutine because when i change standing in the MENU, i get null references to my game engine managers, so i think my method shoul yield return null everytime it encounters with the null managers. But after they are not null, I need to do my action. Maybe it is wrong, I’m not sure. Please help me.

How to execute a coroutine when user clicks on a gameobject?

I am trying to delay the spawning of my prefab, and I tried to do this with coroutines. In play mode, the spawning occurred without delay, but the Debug message did not appear in my console. So I concluded that my Spawn() function is working and the issue is with my coroutine, which was not executed. Below is the code, attached to a game object which will spawn my prefab in its place on click.