Download

ProjectileClass is null

I am following along with the first person shooter tutorial in the docs. I get to the part where we fire a projectile. My code in FPSCharacter.cpp looks like this:

void AFPSCharacter::Fire()
{
// Attempt to fire a projectile.
if (ProjectileClass)
{

}
}

But when I fire the projectile I get that ProjectileClass is null. Any ideas on what I might be doing wrong?

do you set ProjectileClass anywhere?

I don’t set it anywhere, but if you look at the First Person Shooter template and do a search on ProjectileClass, it doesn’t get set anywhere in there either. I’m not sure exactly where ProjectileClass is supposed to get set.

I found it. You have to set the Projectile Class in the FPSCharacter blueprint.