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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Crash on editor start after adding C++ class

Starting from Blueprint only template, added custom AIController class to project via the editor. No other code in project.

First added this: GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("I Worked!"));

works fine. Crashes after compile here and crashes on each attempt to open project: FVector myCharacter = GetControlledPawn()->GetActorLocation();
FVector testVector = FVector(100.0, 100.0, 100.0);
DrawDebugLine(GetWorld(), myCharacter, testVector, FColor::Yellow, false,100 , 0, 15.0);

Comment out all code and rebuild, crashes continue with the same error:

Dump Summary

Dump File: Dump-80018512.dmp : C:...\Saved\Logs\Dump-80018512.dmp Last Write Time: 5/20/2014 3:51:09 PM Process Name: UE4Editor.exe : C:\Program Files\Unreal Engine\4.1\Engine\Binaries\Win64\UE4Editor.exe Process Architecture: x64 Exception Code: 0xC0000005 Exception Information: The thread tried to read from or write to a virtual address for which it does not have the appropriate access. Heap Information: Not Present

System Information

OS Version: 6.1.7601 CLR Version(s):

Replicated crash on a new project with same results.

Product Version: Not Selected
more ▼

asked May 20 '14 at 08:13 PM in Bug Reports

avatar image

3 1 3 4

avatar image timconwell May 21 '14 at 04:32 PM


I first figured that it was the DrawDebugLine that was crashing. But after starting a new project and only adding the on screen debug message, I'm getting the same crashes.

Here are the steps I've taken to get here:
1) New Project -> Code Top Down
2) Create a new character blueprint using the "Hero" Mesh and animation
3) Place character in the scene next to the player controlled default character
4) Create a new class based on AIController -> Save project close Editor
5) Build project in VS2013 -> Restart editor -> Assign new AIController to character blueprint
6) Added GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("I Worked!")); to constructor in custom AIController
7) Compile from Editor and test play. Get "I Worked" message. all is well
8) Close Editor and open project up again and crash
9) Comment out OnScreenDebugMessage in VS2013, build, open editor with no trouble

Seems like any code in the AIController causes the crash. Maybe calling GEngine is bad? Maybe my VS build is off? (MY UnrealVS plugin on the toolbar does not match the sample shown on https://docs.unrealengine.com/latest/INT/Programming/Development/VisualStudioSetup/UnrealVS/index.html - So perhaps this is a sign of a build issue on VS2013's end??)

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

1 answer: sort voted first

Hi timconwell,

Any time you are accessing GEngine through code, it is a good idea to make sure it is available first. Try using the following code in your constructor:

 if (GEngine)
         GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("I Worked!"));

Including this check will prevent the crash you are experiencing when you open the project.

more ▼

answered May 21 '14 at 06:52 PM

avatar image timconwell May 21 '14 at 07:19 PM

Hey, you're right. It did work. Ok, so will make sure that check is run for on screen messages. Still getting crash issues with DrawDebugLine. Tried putting that in the same GEngine check to see if it would make that work too.

Is there another game system that we should check for before calling DrawDebug functions?


avatar image Tim C ♦♦ STAFF May 21 '14 at 08:58 PM

Hi timconwell,

It looks like the crash is actually happening in the line FVector myCharacter = GetControlledPawn()->GetActorLocation();. I did some tinkering and managed to get the crash to stop happening. However, it does not look like it is doing what you want it to do. Namely, GetControlledPawn() does not seem to be actually returning a valid result. Here is the code I have to prevent the crash:

 FVector MyCharacter = FVector(0.0, 0.0, 0.0);
     if (GetControlledPawn())
         MyCharacter = GetControlledPawn()->GetActorLocation();
         if (GEngine)
             GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, TEXT("No controlled pawn"));
     FVector TestVector = FVector(200.0, 200.0, 200.0);
     DrawDebugLine(GetWorld(), MyCharacter, TestVector, FColor::Yellow, false, 100, 0, 15.0);


  1. The if statement checking for a valid GetControlledPawn() result always seems to fail, so the default FVector is always used. You will need to do some additional troubleshooting on this.

  2. I increased the values of TestVector so the resulting debug line is actually visible (at the original 100.0 values it was drawn under the floor and could not be easily seen).

This code will prevent the crash when opening your project, but it will still need some work before it will do what it looks like you want it to do.

avatar image timconwell May 22 '14 at 01:18 AM

My respect and thanks for your help in this. I think I understand now, and in a way explains a curiosity I've had about several of my "Hello World" debug message tests in the past, appearing many times during startup. Appears as if on editor launch it's running the game code. For whatever reason I figured it wouldn't, but instead wait for "play" to be pressed once the editor is up.

Can't help but to think this may be the cause of many of the crash on startup posts I've seen lately. But many, many thanks, you rock. Will in the future keep more environment checks going to not trip up editor loading. Thank you!!!!

(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