Problem with cast.

Hi,i am a total beginner with c++ so can anyone explain to me how can i change the variable FireSound and send it back to the CastingActor?my first day working with c++ so i am kinda clueless,
the casting works and the FireSound is playing correctly,but how do i change its value to the CastingActor?


APistol_PICKUP* csastingchar = Cast<APistol_PICKUP>(CastingActor);
UGameplayStatics::SpawnSoundAtLocation(this, csastingchar->FireSound, GetActorLocation(), FRotator(0.f, 0.f, 0.f), 1.0f, 1.0f, 0.0f, NULL, NULL, true);

You would do csastingchar->FireSound = NewSound;

However depending on how you’re using it, it probably makes more sense to make BP subclasses of APistol_Pickup and set the sound there

Thank you very much.Works perfectly now :slight_smile: