Failed assertion when creating a C++ variable that has a name conflict with a local Blueprint function variable

I ran into a failed assert with very little information when trying to compile a blueprint. The failed assert was because Result was returning NULL here:

UEdGraphPin* UEdGraphNode::FindPinChecked(const FString& PinName, const EEdGraphPinDirection Direction) const
{
	UEdGraphPin* Result = FindPin(PinName, Direction);
	check(Result != NULL);
	return Result;
}

The PinName was “Self.” After compiling the engine into Debug Editor and digging around, I found that it was trying to compile a VariableSet node that was setting a local variable called “TargetLocation.”

This problem occurred after I had created a member variable also called “TargetLocation” for the C++ parent of the blueprint class. This variable was marked BlueprintReadOnly. The blueprint compiler must have been thinking I was trying to set the C++ member variable instead of the local function variable named the same thing. I would expect the behavior in this case to be a failed compile with useful information (name conflict and/or because it thinks I’m trying to set a BlueprintReadOnly variable) not a failed assert with no useful error message whatsoever followed by shutting down the editor.

What’s worse is that if I saved the blueprint prior to compiling it, it would hit the failed asset when I brought the editor back up & just tried to load up that blueprint. Until I figured out what was really wrong there seemed to be no way to fix the offending blueprint!

Please add a check for this case so that future errors like this don’t bring down the editor.

Hi BRB_Justin,

Sorry for the delayed response to your post. I tried to reproduce what you described in 4.14.3, but was unable to do so. Here is what I tried:

  1. Created a new code project.
  2. Added a new Actor code class to the project.
  3. Created a new Blueprint from the new Actor class.
  4. Added a new Blueprint function to the Blueprint.
  5. In the Blueprint function, I created a Vector variable named TargetLocation.
  6. Set the Blueprint function up to set a value for the new variable.
  7. Set the Blueprint’s Event Graph to call the Blueprint Function.
  8. Tested in PIE to make sure it worked as expected.
  9. Closed the Editor.
  10. Added a new FVector variable to the parent code class named TargetLocation and set it as a BlueprintReadOnly UPROPERTY.
  11. Opened the Editor and Blueprint and made some changes to the Blueprint’s Event Graph as well as the graph of the new Blueprint Function.
  12. Compiled the Blueprint, which completed successfully with no warnings or errors, and functioned as expected in PIE.

Would you be able to provide any additional information that would help us to reproduce this?

  • Are you using the binary engine installed through the Launcher, or did you build the Engine from source code?
  • What was the actual error message that you received?
  • Did you perform a hot reload when you added the variable to the parent code class?
  • What variable type is TargetLocation? I assumed it was an FVector, but was it a different type instead?
  • Any other details that you can think of that would help us to reproduce this issue would be very helpful.

This is the error message:

Assertion failed: Result != NULL [File:D:\Build++UE4+Release-4.14+Compile\Sync\Engine\Source\Runtime\Engine\Private\EdGraph\EdGraphNode.cpp] [Line: 107]

I tried the steps you listed above with a new project and didn’t get the error to happen, so I looked back at the actual use case and saw that I was putting more than BlueprintReadOnly in that UPROPERTY descriptor. I thought that BlueprintReadOnly was the case of the error but apparently the offender was Replicated. When I added that descriptor to variable in the new project it hit that assert.

Here is how I’m declaring that member variable:

	UPROPERTY(BlueprintReadOnly, VisibleAnywhere, Replicated, Category = "Enemy|Cache")
	FVector TargetLocation = FVector::ZeroVector;

Sorry, I forgot to answer your other questions:

Are you using the binary engine installed through the Launcher, or did you build the Engine from source code?

The use case I originally reported was from a modified 4.14 engine we built from the source code. When I started a new project to reproduce this bug I used 4.14.3 as installed through the Launcher.

Did you perform a hot reload when you added the variable to the parent code class?

No. I compiled the code in Visual Studio and launched the editor from there.

Hi BRB_Justin,

Sorry for the delay in responding to you. This post slipped off of my radar. I was able to reproduce the issue that you described thanks to the additional clarification about the property needing to be replicated. I have created UE-45155 in order to have this investigated further.