Can't spawn my weapon

I’m having trouble spawning a weapon. I copied the code from the ShooterGame, but I’m getting a NULL back for the pointer to the new actor.



	FActorSpawnParameters SpawnInfo;	
	SpawnInfo.bNoCollisionFail = true;
	AMyWeapon* NewWeapon = GetWorld()->SpawnActor<AMyWeapon>(AMyWeapon::StaticClass(), SpawnInfo);


The weapon class is defined and compiles without errors. What am I missing?