Player Controller Blueprint crashes editor when accessed
I have created custom classes for both "Player Controller" and "Character" in C++. At first I did not have any problems and was able to create the blueprint for both, then run them in my scene. Recently, however, I noticed that when I try to access the Player Controller BP (which inherits from my custom Player Controller script), the editor crashes even though my source code compiles with no errors or warnings. Upon the first crash, I got feedback suggesting that I was calling
"the editor crashes even though my source code compiles with no errors or warnings." Fact that something compiled give 0 guaranty it won't crash. Compiler will only give you errors and warnings to things that cause problems in generation and linking of machine code (code that your CPU run), but it can't won't predict runtime errors, it assumes you know what you doing in logic of your code and assumes your code will predict any problems to prevent crashes. Even higher languages with more supervise nature won't give you all possible error on compile time as it simply can't predict all potential problems that can happen in runtime and can crash application due to unhandled exception (Java in Android case) aka error exception that your code don't handle.
If crash happens first thing you need to do is check log, in Saved/Logs of your project directory. UE4 have assertion system (https://en.wikipedia.org/wiki/Assertion_(software_development)) which detect potential unpredictable instabilities which can cause crash by asserting correct states of things before executing preticilar function. If assertion fails, UE4 crash it self with error log, showing expected condition (a bool, same as "if" statement) that returned false and point where it happen in code and show the stack. Majority of those assertion checks are not descriptive give out only failed condition so it sometimes requires some investigative work, sometimes they pretty obviues, some have error messages even explaining what you should do.
If you see log cut that means unpredicted crash happened, error occurred direcly in machine code execution managed by OS and system cut out UE4 without even notifying it to prevent crash of entire system. Number one cause of this is calling function on null and invalid memory pointers (memory pointers are varables with * in type, all object varables with UObject are pointers) or invalid casting, which causes memory access errors. In this case you should run debug and cause that crash and VS debugger will show you where crash occured in the code. Code you gived
If you want any ferther help you need to explain your code where do you call that function that you mention, whats appeing in logs etc. otherwise people can only guess whats going on
With UE4 it's impotent to understand that your C++ code is a extension of the engine it becomes part of it, you just making extra module to it, one of many already existing in engine code and plugins. Modules (dll files in binary directory) work same way regardless where they are. If something goes wrong in your code the entire engine and editor that runs on top of it goes with it. So makes sure your code works correcly and cooperates with rest of the engine. Don't be afraid to explore engine code to see what engine doing when you call perticilar function you cna learn a lot by doing so. Again your code becomes part of engine so you should know what engine code behaves.
Follow this question
Once you sign in you will be able to subscribe for any updates here