Issue: "Resumed after yield, but class instance is gone" Godot 3.1.1

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By AddCodeluck

I just got finished with my text based game in Godot 3.1.1 however I’ve run into an issue that causes the game to crash when exported. I am very new to game development so I really have no clue how to fix it.

Here’s the problem. I have many yield coroutines within functions to act as a timer node without having to create a timer node. Basically a way to wait for (x) seconds before continuing to run through the program. I looks like this:

yield(get_tree().create_timer(0.2), "timeout")

I honestly don’t know exactly how it works cause I just found it with a google search. It does exactly what I need it to do except it generates errors that read Resumed after yield, but class instance is gone. When expanded, it reads modules/gdscript/gdscript_function.cpp:1771 @ _signal_callback(). It seems this error comes up between 2-5 times when my scene is loaded and not when the yield is actually being executed. Also, another one of my scenes uses the exact same line of code but doesn’t have this error.

Any help would be greatly appreciated and I’ve attached the zip file for anyone to look through. (P.S. I am aware that the code is atrocious and could be done way better. I’m new to programming so this was the way I thought of doing it and I had a deadline so syntax wasn’t my highest priority.)

Thanks in advance!!! :slight_smile:

This usually happens if the node that the yield is on has been freed/deleted, are you using queue_free() anywhere?

Magso | 2020-01-03 19:23

Thanks so much for the suggestion. I found out that the errors were occurring in a different scene that I thought and when it switched scenes, this error came up. I was able to swap out the yield for a Timer node since the programming for that scene wasn’t too complicated. I still used the yield command in my other scene but for some reason the error doesn’t pop up. I don’t know why but I’m just glad the issue’s gone :slight_smile:

However, when I export my game, it crashes as soon as I try to open it. I thought that getting rid of all the errors would fix this but it didn’t and now I have no idea what to do next :frowning:

AddCodeluck | 2020-01-04 04:09