as a side note, AnswerHub has a Code Style options to post code in posts. Should make it easier to post and read
Ah okay. I just found it easier to make a blueprint from the c++ class as then i could easily change weapon types etc.
Thanks for letting me know
You can still create a blueprint from C++
which I wanted to say with
Use that class in Blueprint if you want to
The only thing I suggested is that your player gets a variable
UPROPERTY(EditAnywhere)
TSubclassOf<AWeapon> WeaponClassToSpawn;
this value can then be set in the blueprint of your actor to the weapon blueprint. (the weapon blueprint has to inherit from AWeapon)
and then spawn with:
AWeapon* NewActor = ()->SpawnActor<AWeapon>(WeaponClassToSpawn, NewLocation, FRotator::ZeroRotator);
if you do it that way, you don’t need to define your blueprint class in C++ and don’t need any absolute paths
also if you ever want different weapons you just change your WeaponClassToSpawn to a different class and that’s that