UPDATE: i did more tests on it and when i shoot my logs go 2,3,1 when it should be 1,2,3 all 3 functions are being called on fire but i dont know if the numbers are meant to be in order or not as i put them in order in which they should go in and when i do shoot my gun doesn’t shoot just the log prints
Inside my character .h i allow the user to set any gun to be the primary weapon
UPROPERTY(EditDefaultsOnly, Category = "Setup")
TSubclassOf<class AWeaponBase> PrimaryWeaponBlueprint;
UPROPERTY(EditDefaultsOnly, Category = "Setup")
class AWeaponBase* PrimaryWeapon;
Inside my character beginplay i spawn my gun
PrimaryWeapon = GetWorld()->SpawnActor<AWeaponBase>(PrimaryWeaponBlueprint);
Then i make the shoot method also in my character class
void ALearnProjectCharacter::OnFire() {
PrimaryWeapon->WeaponFire();
}
then in my weaponbase class i have an empty shoot method
void AWeaponBase::WeaponFire() {
}
And then i set it in the .h file
virtual void WeaponFire();
then i made a child class of the weapon base and override the function from the weaponbase class
void WeaponFire() override;
then i setup my gun shooting logic inside of it
void AWeapon_Scar::WeaponFire() {
Super::WeaponFire();
ShootingLogic Here
}