I’ve run into an issue before where some code I’ve written in my project somehow crashes Unreal out of nowhere. However, I wrote this code a while ago without issue, and even after I’ve commented out the line that apparently triggers the crash, I cannot open my project.
Can anyone parse this junk message and give me direction on how to recover my old project?
Move all of your debug code out of your C++ Constructor and into BeginPlay()
Don’t use pointers, even to your own components, without checking them first, especially in a C++ constructor
Probably one of the components, whose pointer you are not checking, got deleted or is not getting properly constructed for some reason, yet you are trying to access it in the C++ constructor, without checking the pointer first.
PS: You also should check your GEngine pointer, it is good practice, especially in a C++ Constructor (the most unstable place to be writing code btw) and better yet, don’t try to use GEngine in a C++ Constructor at all, all your code moved → to BeginPlay = no more problems if you also check every pointer.
PSS: Checking your pointers is free compared to being stuck and having to wait for someone to tell you to check your pointers
Are you suggesting I do this before attempting the on-screen debug message? check(GEngine != nullptr);
What’s more is that I can’t even be sure that the line in the crash report is correct at all. No matter how I change the code, the project always crashes. Is there a way to recompile the code without launching Unreal? That might help.
Have you tried moving all of your logics out of your C++ constructor, and checking all pointers of anything left?
I would try to remove all fancy logics of any kind from C++ constructor and move them into BeginPlay(), until there’s almost nothing left in C++ constructor
Systematic removal of stuff from C++ Constructor will get you closer and closer to
Happy Day
That’s the breath of fresh air you are looking for, because then your editor will load, and crash on game start instead of on engine load (if crash even still occurs)
Okay. The most confusing part was that when I opened Visual studio without launching Unreal, the Solution Explorer view was not visible. I found that I could drag and drop my project’s *.sln file into Visual Studio and I was able to attempt a rebuild of my project.
It got me better feedback, so I know that my EaglePawn.cpp file isn’t so much the issue. But apparently my ObstacleSpawner code is the issue, but it’s telling me that the error is in the generated cpp file, not in the code I wrote. Below is the error output code I’m seeing.
It would appear that you are calling StartSpawn in execStartSpawn, but StartSpawn does not exist, or cannot be found because it’s in another library somewhere?
I had this issue. I am not sure about coding things. But my problem was about deleting some project files or something. When i click material editing or rendering, i had crashes. My solution was:
Verify your project files
Verify your engine on Epic Launcher
Remove and reinstall engine on Epic Launcher
Restart your pc (optional)
Try all this methods and one of them will fix your problem. After try 3rd solution you will get crash for once or twice but if you have crash more than two, your problem different. I solved my problem with those methods.
Note: Don’t delete your project files on your “Operation System” if not needed. Use engine for deleting.
If you really need whatever StartPlay is, You probably have to add the actual function definition in your .cpp, because it is not finding it apparently
void AObstacleSpawner::StartPlay(...etc....)
{
call super?
//What is this?
}
That’s what unresolved external symbol means, the definition (.cpp) can’t be found to match the declaration(.h).
Other times this appears is if you are using a class where the definition is tucked away in a different module, which you then have to include in your build.cs
General Rama Forum Feedback
If you really want great answers from us, you gotta show us more code
.h and .cpp at a minimum, of whatever class is malfunctioning .
In the meantime, you get a Forum A++ For Persistence!
It turns out that that UFUNCTION StartPlay() was indeed the cause of this perpetual crash. I was able to open the *.h file in Visual Studio by itself, and then load the *.sln file in Visual studio after saving that file in order to rebuild the project.
Now, when I launch my uproject, the engine does not crash.