But what exactly is wrong? In this case, your code is specifically written so that the code is only called if the object is not valid (and such scenarios clearly occur, but print is not called). In my previous example, I showed that print outputs previous freed, but in this example, it does not. So what is the difference?
I recorded this two versions (sry about compression)
So I donāt know. Even if Iāve made a fundamental mistake in the code somewhere, I donāt even know where it is or what it is anymore. Maybe I should just be happy that it works
Why are you running fullscreen when debugging? No wonder you canāt catch any bugs. Run windowed with the game window set to āalways on topā or embed the game window into editor viewport. That way you can observe the printouts in real time as they happen.
I usually switch between them if I need print debugging, but that doesnāt happen often, so I switch back for game design testing. I do everything alone, so I have to test different things, and sometimes full screen is better. Iāve already technically solved this error, so I forgot to switch back, iām sorry
Here is a re-run of the comparison with debug, with VSCode off - I tested both situations. In the first situation, there is a freeze - in the second, there is not. However, print is not called, so it cannot be the cause of the error, which is true, but then why does changing this code segment result in the freeze never occurring again?
In any case, even if I made a mistake, I donāt know where I made it. If something like this happens again in the future, Iāll just do another refactoring or rewrite the whole game from scratch. Itās not like Iām new to this. At the moment, I seem to be too far away from understanding this issue
Thatās because you just mindlessly copy pasted the snippet I posted. I only added print lines into your code which was indented using spaces instead of standard tabs, another strange thing.
I only illustrated what it looks when you print everything because it seems youāre not understanding how fundamental and important this is for debugging.
The point is to put print a statement every step of the way to see exactly whatās happening. You can do it on your own using your own judgement. No need to copy paste such a trivial thing. Make this a habit.