Editor crash on Get PC from Pawn Owner in AnimGraph

I’m putting this under bug report, though I don’t know if that’s the case or if it’s my own stupid mistake. Also, I imagine this is the same on 4.13, but I haven’t updated yet to check.

On 4.12, when trying to get the player character using the owner pawn for its world context in an AnimGraph, trying to compile will crash the editor. To be clear, I use the “Try Get Pawn Owner” and pass the result to “Get Player Character”, then ideally use that to grab a value I need to check. I also cast the result of that to my character, but that doesn’t seem to be causing any issues. Also, using the plain “Get Player Character” without input works fine and causes no crashes.

The worst part of this is that, if the above is done and saved before a compile and the crash, the editor will crash on start-up until the offending AnimBP is removed, with no chance to fix the issue or even get a crash report.

Hey ,

Any chance you can post a screenshot of your Animation Blueprint Event Graph?

I do not understand what you mean by, "…use the “Try Get Pawn Owner” and pass the result to “Get Player Character”. As you cannot pass the result of Try Get Pawn Owner into Get Player Character because Get Player Character only accepts a Integer value for “Player Index”.

Thanks.

Sure, here it is.

I have both nodes pulled up in the SS; the one you mention that only takes an integer as well as the one that takes an additional object reference. If the second one didn’t come to mind quickly, though, it makes me think I’m using something I shouldn’t be. Of note, I use the same series of nodes in the event graph without issue.

Hey KingCol32,

There is nothing in your screenshot that would cause a crash. My guess is that it is from something else.

Is there anyway you can give me more information regarding your project?

Thanks.

It should still theoretically work even if I use the bottom “Get Player Character” node instead of the top? Also, I just reread what you originally asked for and realized you asked for a screen of the event graph, but what I posted was the anim graph, where the problem seems to originate. I retrieve values in the event graph in the same way, though, and haven’t had issues with it. I believe it’s also done this way in one of the tutorials, somewhere. I can also post a SS of the event graph, if you’d still like to see it.

There are some values in the animBP that I need, but don’t need refreshed every frame, so I’ve been temporarily getting them in the anim graph or via events in the event graph until I either write my own anim instance or learn how to cleanly set a variable in the animBP when the character/animBP is first initialized, using the vanilla anim instance.

Hm, What other information might help? Off the top of my head, I haven’t made any changes to editor code or to the nodes in question. I do use my own custom instance of the character class. I had this same issue on another BP before, but had to roll it back to an earlier instance in order to continue work, so don’t remember the specifics aside from that I used these same nodes.

Sorry for the text explosion.

Hey again,

I am not 100% sure on what your goal is, or really what you are asking, but as an example, this is how I would generally start to get the local Player Character and cast it in a Animation Blueprint:

Aside from that, are you still crashing? If so, can you post any sort of crash log or crash message you see when the game/editor crashes?

Thanks.

Haha, sorry, that seems to be a common problem with my questions and requests here, and likely why so few of my issues get answered. I’ll try to clean up my response and explanation:

Your screenshot looks to be in an anim blueprint’s event graph, right? My problem happened in my anim blueprint’s anim graph, in a state transition.

Originally, I wanted to get a value “MaxSprintSpeed”. It changes infrequently, if at all, so I didn’t want to check it as part of the “Update Animation” event. I wanted to find a way to check once, or at least very infrequently, but was not able to.

Instead, I tried retrieving the value from a state transition check, in the animation blueprint’s animation graph, so the value would only be retrieved when trying to transition from a very specific state in the state machine to another very specific state. I am just doing this temporarily because it seems like a bad practice.

When I tried retrieving the value using the “Get Player Character” node that takes a world context object as an input, the editor crashes. In terms of my screenshot, hooking that bottom “Get Player Character” node to the “Cast to Default Character” node would cause the editor to crash after clicking “compile”.

Unfortunately, it crashes without any crash report or log to check after. If this change is saved in the blueprint before compiling and crashing, the editor crashes on start-up, also without any report. It crashes until the blueprint is removed from the content folder.

When I use the “Get Player Character” node that only takes the player index, as shown in the screenshot, it works fine.

Currently, what I was trying to do works as long as I avoid using the “Get Player Character” node that takes a world context object in my anim blueprint’s anim graph’s transition check.

As I typed that, I also just realized I probably could/should just make an event on entering a state to set values I don’t want constantly checked.

Can you see if there are any log files in the log folder?

You can get there by navigating to your project folder and going, Saved → Logs.

Thanks.

That’s super helpful; I wasn’t aware of these. Yeah, there are several from from the day I had encountered the error. They all end with the following:

[2016.09.04-06.17.16:155][485]BlueprintLog: New page: Compile DefaultCharacterAnimBP
[2016.09.04-06.17.16:270][485]LogBlueprint:Warning: Compiler Warning  SprintStop to IdleMove  will never be taken, please connect something to  Can Enter Transition 
[2016.09.04-06.17.16:293][485]LogOutputDevice:Warning: 

Script Stack:
DefaultCharacterAnimBP_C.ExecuteUbergraph_DefaultCharacterAnimBP
DefaultCharacterAnimBP_C.EvaluateGraphExposedInputs_ExecuteUbergraph_DefaultCharacterAnimBP_AnimGraphNode_TransitionResult_37E7FC0F43AEE55AEA54E38C12E82145

[2016.09.04-06.17.16:293][485]LogWindows: Windows GetLastError: The operation completed successfully. (0)
[2016.09.04-06.17.20:054][485]LogCrashTracker: 


[2016.09.04-06.17.20:054][485]LogCrashTracker: 


[2016.09.04-06.17.20:054][485]LogWindows:Error: === Critical error: ===
Assertion failed: Object [File:D:\Build\++UE4+Release-4.12+Compile\Sync\Engine\Source\Runtime\Engine\Private\UnrealEngine.cpp] [Line: 7968] 





[2016.09.04-06.17.20:086][485]LogExit: Executing StaticShutdownAfterError
[2016.09.04-06.17.20:101][485]LogWindows: FPlatformMisc::RequestExit(1)
[2016.09.04-06.17.20:101][485]Log file closed, 09/04/16 15:17:20

I had been aware of and expected the warning since, at that time, the transition it mentions wasn’t set up.

Hey ,

I am not sure why you would get an assertion from UObject. Is there anyway you can upload you project for me?

If you want to keep it private you can send me a PM on the forums with the link.

Thanks.

Hey ,

Can you tell me what engine version you are on. Your original post says 4.12. If it is 4.12, can you tell me what hotfix of 4.12, such as 4.12.5?

Thanks.

I’m traveling now, but it should be on latest for 4.12.

Hey ,

I am not sure how you are able to compile your project. I am using 4.12.5 and these were the issues I had to fix before the game would launch:

[DefaultCharacter.cpp] line 29:

CameraBoom->AttachToComponent(, FAttachmentTransformRules::SnapToTargetNotIncludingScale);

To:

CameraBoom->SetupAttachment(  ); 

[DefaultCharacter.cpp] line 38:

SideViewCameraComponent->AttachToComponent(CameraBoom, FAttachmentTransformRules::SnapToTargetNotIncludingScale, USpringArmComponent::SocketName);

To:

SideViewCameraComponent->SetupAttachment( CameraBoom );

[DefaultCharacter.cpp] line 98:

InteractableCapsule->AttachToComponent(, FAttachmentTransformRules::SnapToTargetNotIncludingScale);

To:

InteractableCapsule->SetupAttachment(  );

[DefaultInteractable.cpp] line 13:

InteractableCollision->AttachToComponent(, FAttachmentTransformRules::SnapToTargetNotIncludingScale);

To:

InteractableCollision->SetupAttachment(  );

[EquipmentProjectile.cpp] line 16:

ProjectileMesh->AttachToComponent(, FAttachmentTransformRules::SnapToTargetNotIncludingScale);

To:

ProjectileMesh->SetupAttachment(  );

And, in regards to your crash, I ran through your game for 5-10 minutes and didn’t experience any errors or crashes. With that said, I am not sure what else I can do unless you can give me some more information as to why you think the crash happens.

Please let me know.

That’s really bizarre. I don’t get any issues with those lines, not even warnings. The camera code was actually leftover from the platformer template.

As for the crash, it shouldn’t happen. I thought I’d mentioned it, but I had it fixed so that I could run the game. It wasn’t particularly hard to get around, I just had no idea why it would happen.

Anyway, I’m starting to worry there’s some kind of oddity with my setup, somehow, but if you go into:

character anim bp > anim graph > locomotion state machine > sprint stop to idle move transition guard

And then disconnect the top “Get Player Character” node from the cast and instead connect the bottom “Get Player Character” node to it and try to compile it, it should theoretically crash. If you do that and it doesn’t crash the engine on compile, then I’m not sure.

Hey ,

To begin, I still dont crash with what you said about the moving Get Player Controller references. But, with that in mind, I do want to explain something to you because the way you are using these nodes makes me think that you don’t fully understand what they are for.

108097-481917_pawntochar.png

This as example is going to try and get the Pawn owner and then use that as the reference point to try and get the Player Character. Which, simply, you do not need to do and if you do, may cause issues as to what you are seeing. To further explain, this is the function for TryGetPawnOwner:

APawn* UAnimInstance::TryGetPawnOwner() const
{
	USkeletalMeshComponent* OwnerComponent = GetSkelMeshComponent();
	if (AActor* OwnerActor = OwnerComponent->GetOwner())
	{
		return Cast<APawn>(OwnerActor);
	}

	return NULL;
} 

This is going to try and get the PawnOwner from a SkeletalMesh reference. So, as an example, if there is no SkeletalMesh reference, the function will return NULL then NULL will be used as the World Context Object, resulting it a crash because NULL won’t be able to find anything.

Try to use these nodes for what they are and don’t try to connect one to another just because they can be. Look into the use cases for these different nodes and read on what they do.

I do not believe that the crash you are experiencing is a bug with the Unreal Engine. Instead, I suggest going through your project and tracking down instances where Blueprint or C++ is being used in a way that is either deprecated (out of date) or where you could be use a NULL reference to try and do something else.

Good luck with your project.

Hm, I guess I saw it in the old template and just took it as gospel without looking into it more. Apologies for wasting so much of your time, then, and thanks for the explanation. Still bizarre that it would crash for me, but I’ll just assume it’s no doubt due to one of the wonky things I’m doing.