I add a character blueprint reference variable in my weapon blueprint, but the check is always not valid. Any possible wrong? Thanks!
Where/how are you assigning character to the variable?
Thanks for reply, I type the name I want to reference in the variable type,and choose as reference, any wrong with this?
This is choosing type, you need to provide reference to the object exsisting in game either in “default” field of variable or during runtime (Set FirstPerson node and attach the object reference to it)
I suspect you’re running into an issue where the object just doesn’t exist when BeginPlay is called on the Weapon blueprint. It bouncing between being valid/not valid could be a case of when this stuff executes. Try this. Instead of BeginPlay, test this with Event Tick and watch when it becomes valid. If you always see it become valid at a later time, you know it’s because of the execution loop. In that case, you’ll need to find a more reliable way to do what you’re trying to do.
If it never becomes valid or it’s valid/then loses it, you know something is blowing that value away somewhere else.
Try setting it during runtime. I guess this is a player character, so you can use Get Player Character node with index 0 (if it’s singleplayer game). I’m not sure what you want to do with this, but I noticed you marked editable which allows you to set it up for specific object in the editor window (so you can put your weapon on the map and set it up there, but you’ll need instance of First Person to be on the map too)
Hi, thanks this might be the problem.
Thanks! I tried several ways but only get all actor works.
I still don’t know setting it during runtime means. My weapon is hold by the Firstperson character as a child actor.
Oh, ok. In the FirstPerson character drag the child actor, from it get child actor, cast it to weapon class and from it set FirstPersonBP with self node