Adding a reference to the player controller crashes editor when relaunching

I’m so depressed because I’ve worked for a long time on this project, it was potentially my income, and how every time I add getting a reference to my player controller in a blueprint that’s central to everything where I need to do it, the code will run fine, but after closing and launching the editor, it crashes at 93% every time.

All I do is get player control it, cast it (can even cast it to player controller), save it as a variable. Compile, save, close project, open project, crash at 93%. Project is useless.

I can’t replicate this by starting a new project. It just started happening. This is the second time I’ve gotten a crash on 93% error, I also had it with a different blueprint, my AI. I had to delete a child blueprint entirely to fix that.

I’m really hoping I can get some help here this is kind of my livelihood and it seems like there will be no way to debug this which is beyond depressing

I tried 4.18 and 4.17 both have these issues. I can’t go back to 4.16 as I rely on 4.17 VR features.

There’s nothing fancy going on. Literally just adding a get player controller, cast it, and save it as a variable is enough to entirely destroy my project, if it weren’t for source control. The ability to reference my player controller in this blueprint is 100% critical to my game, and I can’t rebuild the blueprint and remake everything as it’s literally my actor that that controls all VR interaction.

please help :frowning:

Edit: here’s the error log http://freetexthost.com/l5lzizzlhx

Edit: So I’m able to prevent the editor from crashing at startup by setting a new map that doesn’t have any references to the player controller.

Creating ANY reference to my player controller - that’s new (I have old ones…) will instantly crash the editor, after restarting, if you drag an object that has a reference to the PC into the world

I tried duplicating and making a new PC. Same issue with that.

So my project is basically over. Because I can’t reference my player controller at all. Please help

Where are you trying to get the playercontroller from (what blueprint)? And is this a blueprint only project?

So it actually doesn’t matter. If I put Get Player Controller and do anything with it, and close the editor and start it back up, if there’s an actor that does that in the world, crash before project starts.

If there isn’t, but I drag one into the world, crash. Even though the code works fine before closing the editor.

Literally just get player controller does this

However, I found a workaround… I can Get Player Pawn, cast to Character, Get Controller, and then cast that to my controller… that works perfectly fine. But Get Player Controller shouldn’t destroy my project, obviously, so I’m not too confident about this workaround

1 Like

It could matter where you are calling the Get Player Controller. I’m not sure when constructors and stuff are ran in regards to starting the editor, but it’s possible they are called for everything that’s in the scene. Which would be a reason why the editor crashes because if you try to do something with the player controller and it doesn’t exist. I would put a check to make sure the player controller exists before doing anything with it and try that?

The crash occurs even if I make a new actor, that on begin play, gets the player controller and casts it. It doesn’t matter if I hit player or not. Simply having it in begin play and dragging this actor into the world (AFTER restarting the editor) will cause a crash. No code is actually being executed.

Yeah I understand what you’re saying. I would try checking to make sure Get Player Controller() actually returns something before trying to do anything with it. If the crash only happens when that actor is in the scene on startup leads me to believe the engine runs some amount of code to generate a scene on startup, and when it checks for player controller it doesn’t exist and then crashes because it’s trying to reference a null pointer. I’m not sure, that’s just my guess.

Did you try the following? (first make a full copy of your current project just to play it safe):

  • Delete all folders/files from your project except Content, Config and the .uproject file. Then restart and rebuild it.

If that doesn’t work:

  • Open the project on the map that works and Migrate your crashing level to a brand new project. Migrate will take care of all dependencies. Open the new project and check whether that works.

Hey Pinworm,

I took a look at your log that you provided, but it doesn’t appear to have the callstack from the crash in it, so I can’t say what could be causing it based on that.

If you can cause the project to crash again, and provide me with the callstack that should show up in the Crash Reporter window after the crash occurs. Also, if you can provide another log right after the crash occurs, that may help as well. You can find it in your project’s Saved->Logs folder and attach it to your reply to my comment.

If you get a message in your Crash Reporter window that says you do not have the debugging symbols installed, go to your Launcher, and next to your engine version Launch button in the library tab, you’ll see an arrow. Hit that arrow and go to options, which will bring up all of the optional things you can install with the engine. Editor Debugging Symbols should be one of them, and these will allow you to see the callstacks of your crashes.

Thanks

i got exac same problem in one of my projects, but method works in other.

Hello,

I’m marking this topic as resolved for tracking purposes, as we haven’t heard from you in a while. If you can provide the information I requested in my previous comment, feel free to respond to the thread to reopen it for investigation.

Thanks

I had this problem in UE 5.0.1, and I upgraded it to 5.1, copy opened the project and the problem is gone.