Spawn Actor crashing

Hi,

May you be great!

Cast is template function, so you must give a type when using it, which meas the right syntax is Cast<APawn>(GetOwningActorFromActorInfo()), you also can avoid the first Cast, simple add your AbilityWeapon in your SpawnActorDeferred directly once it is a TSubClassof.

If I can give you an advice, before use any Pointer, always ensure if it it valid, it’s a good practice, for instance:

if (AbilityWeapon)
{
	const FTransform SpawnTransform = FTransform(FRotator::ZeroRotator, FVector::ZeroVector);

	if (APawn* Instigator = Cast<APawn>(GetOwningActorFromActorInfo()))
	{
		ARA_Weapon* SpawnedActor = GetWorld()->SpawnActorDeferred<ARA_Weapon>
		(
			AbilityWeapon,
			SpawnTransform,
			GetOwningActorFromActorInfo(),
			Instigator,
			ESpawnActorCollisionHandlingMethod::AlwaysSpawn
		);

		if (SpawnedActor)
		{
			// Set your properties ... 

			// Finally
			UGameplayStatics::FinishSpawningActor(SpawnedActor, SpawnTransform);
		}
	}
}

May that help you, Bye!