SetCameraTarget bricked my project

I was trying to port some of the StrategyGame template to my own project.

When I added the line

StrategyCameraComponent->SetCameraTarget(offset);

it crashed my UE4, now whenever I try to reopen the project, it crashes with error stating
among other errors

UE4Editor_CDC_3361!AMySpectatorPawn::AMySpectatorPawn() [
<snipped>\private\myspectatorpawn.cpp:16]

Which line 16 refers to what I mention above. However even though its not commented out. It keeps crashing my UE4, because its using some cached version now. What files do I need to delete/edit so that I can reopen to recompile it? I tried removing the relevant myspectatorPawn.generated.h for that file, as well as the myspectatorPawn.cpp.obj in the UE4Editor folders, but thats not enough.

Any thoughts? Thanks!

Hello namrog84,

Can you post the rest of the callstack from the crash? Also, you should be able to just rebuild from VS to fix this if you comment out the code that is causing the crash. If that doesn’t work, you can delete the Binaries / Intermediate / Saved folders and then right-click the .uproject file and select “Generate Visual Studio Project” and then compile again after that.

Deleting the most recent binary files(I think it was a pdb and something else) was the workaround I found. Since this(preventing my project from being openable) has happened numerous times for several different reasons.

I believe it was because I was doing things in the constructor where I should have been doing it in BeginPlay or somewhere else and it was trying to call a function on a null object. The current version I have doesn’t have any of the same code anymore since I’ve rewritten it to be handled differently. However, the next time it happens, I will be sure to post the the full callstack and set aside a version of the file.