I want to make it easier for me to make a weapon sound or any sound in general using an object with the set and use an anim notify to play said sound in the animation. i just need to figure out how to correctly reference the object (weapon) the player is using to play its set sound. Is it possible?
You can get a reference to the owning actor using the GetOwningActor node. If the owning actor is a pawn you can use TryGetPawnOwner
Sadly. It says it will always fail since it’s an “Object Blueprint” and not an actor.
Actually, I’m confused by your description, so I have to discuss in several situations.
-
If your weapon object class is written with c++ and can’t make your weapon instance a reference to blueprint, you can add some params in your wepon’s UClass() macro like this:
UCLASS(Blueprintable, BlueprintType) -
If you want to find out a way to access your weapon in UAnimNotify, you can create a reference of weapon in your character blueprint and access them like Clayton mentioned.
-
If your weapon holder is a UObject, like a WeaponManager, you can reference your weapon holder object in your character blueprint and access them like Clayton mentioned.