AI Cars and AI NPC Robots Chase (Unreal Engine UE4/5)

Showcasing Unreal Engine‘s move to pawn location functionality. AI cars and NPC robots have been programmed to follow the player pawn to whichever location she/he/it (third person character or car) decides to go. AI characters apply force and damage whenever they hit the player pawn. Two health bars update the two player pawns health levels respectively for the third person character and the car being driven.

How to solve “Blueprint Runtime Error: Attempted to access missing property”

You might get this error after you add a new variable to your C++ code that you want to be accessible in an Unreal Engine Blueprint. This can be done by using the UPROPERTY(EditAnywhere, BlueprintReadWrite) macro. After rebuilding your solution, you probably expect the variable to be available to the Blueprint right away (and it may very well be), but you might be surprised that sometimes you get runtime errors like this not only for the variables that were already Blueprint-accessible and working properly but also the new one(s). Searching the Internet for a solution didn’t offer much help. So, what’s the solution? Although you might expect that building the C++ solution also compiles the Blueprints, this is not always the case. Although Blueprints are turned into C++ classes through a process called Blueprint Nativization, the Blueprints are not always recompiled when you compile the C++ solution. And it seems that this is a long-standing problem (or bug). After adding the new Blueprint-accessible variable to your C++ class and compiling it, make sure you recompile the Blueprint itself from the Blueprint Editor. If you have multiple Blueprints that are suddenly showing this error, you can also right-click on the Blueprints, go to “Asset Actions”, click on “Reload”, then recompile the Blueprints. The variable should then be available to the Blueprint.

© Nicholas Nachega