Download

Crashes the Engine when Creating object

Why does this code crash the engine? I cant seem to figure out why


	UWorld* const World = GetWorld();
	if (World)
	{
			
	FActorSpawnParameters SpawnInfo;
	SpawnInfo.Owner = this;
	SpawnInfo.Instigator = this;
	SpawnInfo.bNoCollisionFail = true;

 World->SpawnActor<APickup>(WeaponClassToGive, GetMesh()->GetSocketLocation(TEXT("EyeSocket")), GetMesh()->GetSocketRotation(TEXT("EyeSocket")), SpawnInfo);
			}

nvm mark as solved i just did this. My Cast was incorrect for the object type does anyone know how to set a reference to a skeletal mesh or class in UE4?



 World->SpawnActor<AWeaponBase>(WeaponClassToGive, GetMesh()->GetSocketLocation(TEXT("EyeSocket")), GetMesh()->GetSocketRotation(TEXT("EyeSocket")), SpawnInfo);