Unknown error plagues my project

For a while now I was getting random crashes during playtime. This error only occurred once projectiles were introduced to the project; upon where sometimes the game would crash at random when trying to spawn a projectile. I tried to attach a debugger to the project but every time I do this, visual studio sits with a loading symbols dialogue box for over 10 minutes.

Now this problem has gone to an extreme level. After implementing the firing status enum to the firing condition, despite this extended behavior working fine, when I fire to spawn a projectile I get this freeze/crash every time. The behavior of the program is identical except in the condition in witch a projectile is spawned or not.

I don’t see any new nullptr’s that could be causing this as

if (FiringState != EFiringStatus::Reloading)

is the only thing that has changed in my firing method
If someone wants to take a look and attempt to run a debugger on it that would help alot.

Project here:

I actually just tried taking off all behavior in the fire method, which makes things even more confusing since it operates the same way as it had before… It is very hard to narrow down the problem since as far as I know I protected all the pointers, it was working before this minor change, though before the minor change, there was still the odd problem of it randomly crashing, only this time it is persistent. Very encumbering and mind boggling; I dont even know if it is only on my PC since before the crashes were close to random. This time it should be consistent though since the problem should be seen right away when trying to firing a weapon. (or if an AI tank fires, that will crash it too)

OK so this is half solved. It was in part a bug. What happened was when I readded my aiming component to fix a differnt bug earlier, I didn’t set a projectile reference to spawn. However, I say this is a bug because in my code i actually checked to see if there was a version of projectile set before executing code. therefore the projectile class should not be referenced by my program if none is set. Despite this, my program crashes anyway, unless I set one in the blueprints. This was the only place in code it is referenced in order to spawn an actor of its type.

This still leaves the problem howveer that, well for one, why does this happen, for two, my program still is expected to crash at random due to the other underlying problem that started when I added projectiles to the project several lectures back, and for three why i can’t attach a debugger to UE4 without visual studio getting stuck up on the symbol that’s displayed in my screenshot.

And yeah I just tested it and after a few minutes of gameplay my game randomly froze again. Had to end task

Is there a way to set a default initializer for a Tsubclassof<> ? That way i can give it a regular projectile class if it doesn’t find any, since a possible suspect of the bug is this projectile class being null. Probably a shot in the dark but at least i’ll know how to do so if not. Hmmm… I just recalled you can probably do this with a construction helper; might try this later.

Wow this bug is so strange, when I compiled my code for the upcoming video on applying sideways friction, the same crash happened when i fired my weapon. i checked the tank blueprint and it had a projectile class set, which means it should be working. But irreguardless, I tried setting it to none, saved & recompiled, then set it back to the projectile class blueprint, saved & compiled then i didnt get this problem again . -_- ffs.

Privacy & Terms