Why Unreal Engine Keep crashing?

It keep crashing every time when launching into the project at “Initializing 71%” after I changed one line of my C++ coding and compiled it on Unreal. I am new in Unreal and do not know what happened.I cannot create anything if it keep crashing.


[link text][2]
[link text][3]

Welcome in world of native code development where you are not hold by hand like little baby :slight_smile:

First of all you need to remember that your C++ code runs direly in CPU, any mistakes there might end up with crash and it is your responsibility to solve it, or else crash really happens in engine code out of your control then oyu can call it a engine bug (but you know with your skills you can also fix engine code). In other word you no longer end user anymore you developer and you also need to deal with those crashes too. Your code module is no different from other modules in engine, technically by coding in UE4 you extending engine code it self, your code becomes engine code, so if something happens in your code entire engine goes with it. That is prize of having low level access to engine

2nd your code can effect engine initiation, specially if that line was in class constructor. Engine create class default objects CBOs on initiation of code modules, this runs constructor in class, so if you do something wrong there engine will crash on initiation when your module is loaded.

Now here tips how to solve crashes, first and foremost you need to do is check logs, in your project directory Saved/Logs engine prints out crash information there. Most cases of crashes are controlled crashes, engine stops when it detects the problem in code, it has assertions system ( Assertion (software development) - Wikipedia )that checks if everything is in proper state before executed specific portion of it’s code, by doing if-like checks with check functions, if conditions givin to them return false engine stops and prints failed condition in logs, some of them are very descriptive and directly point you do cause also check lines before crash in logs as error might be printed there and direct you to cause. Other kind of crash is uncontrolled crash, which where oyu have serious issue in code like invalid object pointer and attempt to call function on null pointer, in other words memory access violation, i. In that case OS is the one stoping application and UE4 sometimes don’t even have a chance to print out the log, in that case run engine with debugger on and when crash happens. n this case you need to check if object you calling on is initiated, if we tlak about constructor is is usally run during initiation of engine where not everything is initiated, if you need anything specific that is not avable in class copnstructor do it in diffrent event like a BeginPlay or PostInitializeComponents

It is also importent to look on call stack, it’s a list of chain of function calls which was executed during crash, usually directing you to corprit, in that list you can search for any involvement of your code in crash and altest function called is where your code directed engine to path of crash, the next function is one your code called and caused crash. If you dont see your module and functions in call stack, your code still may indirecly caused crash, thru it is rarely for it to be uncontrollable crash. In case of assertion fail, call stack at the end will also contain functions that finally printed information in log and shut the engine, which ofcorse didn’t caused the crash, go back until you find check function.

Also go download engine source and symbol files (PDBs) or else call stack won’t show the function names inside engine modules, without then VS don’t know what part of the code is executed (you module will be visible as PDBs for it are generated in compilation process), you can get by customizing you engine installation, there option for it there, it super useful… practically needed in debugging crashes, you need to get them if you think about doing C++ in UE4, or else you gonna be lost in some crash cases

For ferther help you need to explain your case, tell me which line did you modified and where because this is most likely the cause of your problem.

please replace CBO with CDO (class default object)

p.s. great answer like always :]