I'm coding a multiplayer game in Unreal Engine 4.15.0 and it's almost working except for a freaking line of code that I can't figure out it's behavior. The problem is that I have a OnlinePawn Blueprint that inherits from a C++ base class AOnlinePawn. Whenever a player joins the match I spawn this Blueprint and cast it to an array that I update constantly receiving data.
This document describes how to use the Creature runtimes in the Unreal 4 Engine. The language of the runtimes is in C. We will go through an example of how to load an exported JSON file and play it back in the scene. Using Creature in Unreal Engine, the Basics.
The problem is that the following code that tries to casts AActor* returned by the function to AOnlinePawn* fails and returns null, it's a cast issue as it is indeed spawned.
The cast:
The blueprint reference:
The Blueprint description, stating the parent class:
So, what's the problem here? There's anyway I can improve my workflow? There's a workaround?
Gabriel GarciaGabriel Garcia
1 Answer
I think your cast line is not correct. SpawnActor is a template function, you are not supposed to cast it manually like that. Instead, you should simply give it the type you want to use. Try it like this:
EDIT:
You're welcome. So if you actually want To reference a blueprint in your code you can either use the constructor helpers or the class finder.
MoumsMoums