I have a C++ Pawn class, ‘MyPawn’. I have a subclassed blueprint version where I can change the mesh, etc in the editor.
Similarly I also have a Projectile class and a subclassed blueprint version.
I’m trying to set which type of projectile a type of pawn shoots, like so:
UPROPERTY(EditDefaultsOnly)
TSubclassOf<MyProjectile> ProjectileType;
This appears fine in the editor and I can select the base projectile class or my blueprinted subclass which has a mesh assigned, etc.
Now, I’m trying to spawn one of those projectiles and I have no idea how to do it. I’m looking at the docs and every version I try doesn’t seem to work. I have:
GetWorld()->SpawnActor<ProjectileType>(ProjLoc, GetActorRotation());
I get the error 'UWorld::SpawnActor': no matching overloaded function found
.
For that matter: GetWorld()
is underlined with an error that says pointer to incomplete class type is not allowed
In fact, many parts of my code have been getting underlined saying either the ‘incomplete class’ thing or “undeclared identifier”, even when it compiles and runs just fine. I have no idea why and it’s completely infuriating. I always seem to get this issue when working with custom enums or structs… it makes intellisense totally break down even if the code actually compiles just fine. Help?