GetOwner() crashes editor

Edit: Post deleted. It was the result of a silly mistake on my part.

Someone might make the same mistake. It’s always better to edit in the solution.

Relevant xkcd

Yes, normally I agree. But this question should never have been asked in the first place, so I wanted to delete the entire post. Doesn’t seem like this is possible, though.

Fair enough, Is it not in the option when you try to edit the title?

Not that I can see.

given that I just crashed my entire project on this lesson with an error for GetOwner(), I would agree that it might have helped others learned if the question (and solution) were still there…

In my case, I knew what I did almost immediately… I’d put a UE_LOG in the TankAimingComponent Constructor which included *GetOwner()->GetName(); I’m not sure they why of the crash… (might have mispelled something) but I did learn that if you have a fatal error in a constructor, you might have one heck of a time restoring your project… The fatal error occurs during the Constructor which is called within the editor before you ever play the game… When you reload, same fatal error occurs… You can’t compile in VS while the editor is closed, but you can’t open the editor without recompiling…

Had to do a complete reset from the last commit, which is a fantastic way to kill an entire evening. On the plus side, I can now confess that during the chapter on resetting in the previous module, I didn’t actually do it, opting to “watch Ben do it”. Now I can cheerfully proclaim that I’ve done it, I’ve restore from a commit.

  #include "NoShortcuts.h"

I’m afraid neither the question nor the solution would have helped you in this case, Brian.

However, I’m curious about your statement “You can’t compile in VS while the editor is closed”. What’s preventing you from opening the project in VS, correcting the mistake and building, without ever opening the editor?

I believe it was returning an error that there was no Makefile or something to that effect… Once I reset (after having removed the GetOwner() reference, I had no trouble.

It turns out, though, that the reason GetOwner()->GetName() was crashing was because I’d done something dumb, and built the TankAimingComponent based on AAActor instead of UActorComponent()…

I seem to be getting this crash as well, and i have had previous issues in the Unify AI & Player aiming video. I was constantly getting a LNK 2001 and LNK 2019 error after i added the code from that video. I decided to go ahead without adding the code as assumed it might have been a version error (i am using 4.17), because my previous code compiled and ran just fine. Now it crashes after adding this code, and its because of the new Macro line in TankAimingComponent.cpp. Any ideas of what i should do? Where i should go back to? I have all the commits but i don’t even know where to begin, where did i **** up?

Oh yeah sure censor my posts asking for help, but no one helps. Anyways i just went back a few videos from Unify AI and re did everything i did before. I am now on video 134 with flawless code! In the end I did not really find out what i did wrong, but i do have some suspicions.

Lecture 133:

I had the same crashing problem after adding GetOwner() before the GetName() that we cut from Tank.cpp (along with the UE_LOG)

What I had to do was close the unreal editor and then perform a rebuild in VS 2017 before re-opening the unreal editor and then the game ran fine with no crash or errors.

FYI: I’m using UE 4.18.2

Privacy & Terms