Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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 GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint and this was causing a problem (I have references to my custom Character class in my Controller and perhaps this was causing a circular dependency of some sort). I removed that line and now the editor crashes, but with no useful warnings whatsoever. Anyone know why this could be? Any help is highly appreciated! I just noticed I am also getting the log warning "Couldn't goto line number '0' in '../NewPlayerController.h'

Product Version: UE 4.17
more ▼

asked Mar 28 '18 at 03:43 PM in C++ Programming

avatar image

174 44 39 49

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

"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 GetWorld()->GetFirstPlayerController()->GetPlayerViewPoint can potentially crash UE4 this way if GetWorld() return null ponter which can mean that world is not initiated or actor it self is not fully initiated and don't have world assigned, GetFirstPlayerController() return null if there is no any player controller initiated, in most cases it is calling those functions in too early stages of initiation either actor or a world. So check where do you call those functions. Before calling functions on other functions that may return null pointer, check if they return null before calling to prevent crash.

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.

more ▼

answered Mar 29 '18 at 07:58 PM

avatar image

37.8k 937 172 1123

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question