I want to set up a dynamic weapon and pickup system.
I set up all the relevant pickup infos in the contruction script of the pickup-template blueprint (i cut non relevant info out to focus on the relevant content for my issue). If a weapon is picked up you can equip it. The logic for this is stored in the character blueprint.
In the character blueprint are also implemented the possible weapons as child-actors (invisible). If one of these weapons are picked up and equiped they should turn back to visible.
So the problem is - i don’t know why, but the “WeaponActor” seems to work not as i assumed. Why? No Weapon is turning visible if i equip them.
You should place a Print String after your Event User Action to make sure that gets called properly. And another one after you call Set Actor Hidden in Game to check that your code gets all the way to that point. Finally place a third one to check your weapon’s visibility status (IsVisible) after you have set it. This should highlight where the problem is.
I tried to set it up differently. I put the variables directly in the characters blueprint and set them there, that worked fine! But it seems that the child-actor transfer not work.
Not easy to tell. Typically weapons are own Actors (Blueprints) and are spawned or attached to the player at runtime, also because they may already sit somewhere in the level waiting to be picked-up and dropped later on.
You are doing it differently, with the weapons pre-created as part of the player and then made visible/hidden as needed. Not sure whether this is the best way to go and it may cause dependency issues. This is why I was suggesting you to make sure everything works as expected. I am not saying it doesn’t, but it is not the traditional way of doing it.
What if you skip all the attach to code and just check whether you can turn one of the weapons visible just by hitting a key? Keep it simple and see if it works that way, then you can always make it more complicated later on.
Good! Happy to hear that. I have converted my comment to an answer so it can help others in the future. Kindly mark it as accepted if you are ok with it.