VS2015 Debugging exits on UE4Editor.exe has triggered a breakpoint

Hi everyone I’m having a little bit of trouble with my project, the project compiles completely and without any errors or warning but when I try to launch an instance to debug the game, it suddenly tell me that the “UE4Editor.exe has triggered a breakpoint.” and it immediately exits the UEditor.

Here is a copy of the Output log which VS2015 makes during compiling:

'UE4Editor.exe' (Win32): Loaded 'D:\Desarrollo\SOP Projects\SOPClicker\Binaries\Win64\UE4Editor-SOPClicker-Win64-DebugGame.dll'. Symbols loaded.
Fatal error: [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.10\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 2071] 
UObject() constructor called but it's not the object that's currently being constructed with NewObject. Maybe you trying to construct it on the stack which is not supported.
UE4Editor.exe has triggered a breakpoint.

UE4Editor.exe has triggered a breakpoint.

[2016.01.06-11.22.28:942][  0]LogWindows:Error: Windows GetLastError: The operation completed successfully. (0)
[2016.01.06-11.22.28:942][  0]LogWindows:Error: === Critical error: ===
Fatal error: [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.10\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 2071] 
UObject() constructor called but it's not the object that's currently being constructed with NewObject. Maybe you trying to construct it on the stack which is not supported.




[2016.01.06-11.22.28:994][  0]LogExit: Executing StaticShutdownAfterError
[2016.01.06-11.22.28:995][  0]LogWindows: FPlatformMisc::RequestExit(1)
The thread 0x3b8 has exited with code 3 (0x3).
The thread 0xa3c has exited with code 3 (0x3).
The thread 0xd18 has exited with code 3 (0x3).
The thread 0x22fc has exited with code 3 (0x3).
The thread 0xb4c has exited with code 3 (0x3).
The thread 0x168c has exited with code 3 (0x3).
The thread 0xec4 has exited with code 3 (0x3).
The thread 0x39c has exited with code 3 (0x3).
The thread 0xad0 has exited with code 3 (0x3).
The thread 0xbb0 has exited with code 3 (0x3).
The thread 0x140c has exited with code 3 (0x3).
The thread 0x2354 has exited with code 3 (0x3).
The thread 0x2050 has exited with code 3 (0x3).
The thread 0x1e90 has exited with code 3 (0x3).
The thread 0x22bc has exited with code 3 (0x3).
The thread 0x19d0 has exited with code 3 (0x3).
The thread 0x22cc has exited with code 3 (0x3).
The thread 0xe7c has exited with code 3 (0x3).
The thread 0xfe4 has exited with code 3 (0x3).
The thread 0x22c has exited with code 3 (0x3).
The thread 0x2360 has exited with code 3 (0x3).
The thread 0x1ab4 has exited with code 3 (0x3).
The thread 0x85c has exited with code 3 (0x3).
The thread 0x10e8 has exited with code 3 (0x3).
The program '[7284] UE4Editor.exe' has exited with code 3 (0x3).

Any help would be greatly appreciated.

Edit: Eliminated all the useless data that had nothing to do with the error,

the problem comes from me trying to initialize in the GameMode this line

PlayerControllerClass = AInputManager::Instance()->GetClass();

So I had to change it to this for it to work again:

PlayerControllerClass = AInputManager::StaticClass();

So is there anyway for the code mentioned before to work?? where i create my own instance and then pass it to the PlayerControllerClass in the GameMode??

Hello ,

Are you only experiencing this crash when you try to launch the project through debugging or does it also occur if you try to open the project in the editor normally? I understand that the compile succeeded but it would be helpful to see your code as well as the issue could be there.

Hi, this crash happens also trough the editor, when ever I try to load the project it stops like at 70% and gives a crash but there is no info in the log or the crash report, I don’t have much code made jet but the last time this happened to me it was because I was using the GetWorld() method in a constructor, I moved all the related code of the GetWorld() to the begin play and it started working again but after I added a iterator to find all camera objects in the editor it started failing again. What would you need to help me sort out this problem?

Ill go ahead and add the code that I changed, since after I added this part is when the crash began to happen

I see that you’re already doing this inside of MainPlayer, but you should also check to see if the world is valid before using it in CameraManager, for that iterator. It could be returning as null and causing a crash.

So the reason of the crash in this case is because I don’t have a check for the GetWorld()? or is it because I’m using it without a variable? Any other pointer you can give me about the code or anithyng else?? I’m still quite new at Unreal and this is a small game I’m doing to learn more about the engine.

Thank you.

It’s a general coding practice to always check pointers that can potentially be null before using them, whether they’re stored in a variable or not. I can’t say for sure what the cause of the crash is seeing as you’re not getting a callstack but I’m just taking a guess from what I see in the code. Could you upload the log files from when you get these crashes? You can find them in the project directory under Saved > Logs. If you could up the .txt files located there and upload them, that may be able to tell us the exact problem.

Ok, I will do so when I get home, right now I’m at work.

Hi I added the check for the pointer but it still crashes, I added the logs from the crash hope that helps to sort out whats happening, thank you.

Seeing as you mentioned that adding the iterator caused this crash to occur again, have you tried removing this iterator to make sure that it is causing the issue?

Nope, the crash started after I did the changes in the code I posted, everything that is in the Code in the Original Post it all the changes I did and it’s exactly then when the crash started, but I also commented everything and it still crashed and I’m not sure why anymore.

Hi it seems I found out the problem but now I want to check if is it’s possible to use this line of code in the Game Mode when binding the PlayerControllerClass:

PlayerControllerClass = AInputManager::Instance()->GetClass();

Would it be possible for you to send me a copy of the project? If you wish for it to remain private, you can send it to me in link in a private message on our forums. This is so I can take a closer look and do some troubleshooting that would be a multi-step process if we keep going back and forth.

[1]:

I’ve never tried using something such as that, but I’m guessing this is in the constructor. If that is the case, using an instance of a class in a constructor most likely won’t work out very well.

Ok,yes that is the main problem, so I’ll change that, but know the iterator for the world is crashing the game, I’ll send you the cod tomorrow, since here is 11pm and i have to go sleep for work, sorry.

It’s alright, take your time.

Hi I just sent you the project, I hope it helps. Thank you.

Thank you for sending me the project. When I first received the project, the crash was occurring so I messed around with commenting out some code and noticed nothing was changing. Apparently something is wrong with the project where the DLLs aren’t getting updated.

After deleting the Binaries, Intermediates and Saved folders, I regenerated the Visual Studio Project files and recompiled. Even then, when going to open the project it still said the DLLs hadn’t been compiled which is odd. After hitting “Yes” to compile the DLLs however, the project launched without issues.

It seems that you can use this to work around the crash for now, but I’m going to look into why the DLLs aren’t being updated on compiles from Visual Studio

Hi I finally got the project to start up and to play but when I get to this part of cone in the MainPlayer
ACameraManager::Instance()->ChangeMainCamera(CameraInScene::TopCamera);

It crashed when it tries to create the camera instance, did this work for you in the project I sent you?

Hi just wanted to tell you that I finally got it to work, there where a lot of problems with the instances and other things, but I finally was able to clean the code and get it to work. Thank you.

Glad to hear it. Please let me know if you run into any more issues.