Blueprint cast question
Hi, I'm working on a simple weapon base currently. I just added the first weapon which is a child of the base. I'm attempting to access a variable called "WeaponSound" in the weaponbp. I'm casting to the weaponbp to read the value of WeaponSound so it can play the weapon-specific sound when it fires.
Here is what I have so far: https://i.imgur.com/hIzdBSL.png
I have tried using "self" as a reference, it doesn't return the yellow warning, but it still fails every time. I've tried just about every object/reference I can for the object input on the cast but nothing is working. Thanks in advance! :)
Your 'gun' variable looks like it is just a skeletal mesh actor. What is the parent class of the 'm1garand_bp'. Your 'weapon_base' class is just an actor, so casting to 'm1garand_bp' will also fail every time.
Where do you spawn or create your 'm1garand_bp'? You will need to store an instance of this somewhere and find it. You could try 'GetAllActorsOfClass using 'm1garand_bp' as the class, just to make sure you actually have one of them somewhere?
answered Feb 08 '18 at 10:31 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here