Owner is a reference on an AActor and your staticMesh is not an AActor*.
So if you are beginner i will give you a good method but i don’t know if it is exactly what you want.
I suppose you have an Actor named MyWeapon and this weapon can fire 2 types of Projectile
You have 3 Class of projectile:
-
MyCPPClassOfProjectile (Abstract class / you can’t instantiate it / it has a UPROPERTY staticMesh)
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Projectile)
UStaticMeshComponent* YourMesh -
MyBluePrintProjectile1 (subClass of MyCPPClassOfProjectile )
-
MyBluePrintProjectile2 (subClass of MyCPPClassOfProjectile )
With BluePrint Interface you set the staticMesh of your choice in both MyBluePrintProjectile
In your class MyWeapon:
You have a list of MyCPPClassOfProjectile that can be spawn.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Weapon)
TArray<TSubclassOf<MyCPPClassOfProjectile> > List_ProjectileType
In BluePrintInterface you add to the list both of your MyBluePrintProjectile
In MyWeapon where you want spawn a projectile:
GetWorld()->SpawnActor<AProjectile>(List_ProjectileType[TheTypeYouWant], ProjectileLocation, ProjectileRotation);
I dont think it is really clear, ask more question if you need.
Good Luck