Hello. I’m trying to create an equipment system that allows me to equip multiple weapons. In order to do this i used this interface and this system
and the problem is?
the mesh is hidden and i can’t see it in game
what do you mean hidden? is it even being equipped? if its “Hidden In Game”, have you tried pulling the node “SetHiddenInGame” from the skeletal mesh?
when I pickup a weapon and equip it, nothing happen. i viewport i select “visible” and unchecked “hidden in game”. i tried to use “set visibility” in blueprint but it still don’t work
I think you are misunderstanding how to implement Interfaces. here is a summary.
- You create the interface (like you did)
- Add the interface to the target blueprint you want to respond to the Message (if you want to turn off the light on a bulb, i implement it on the blueprint of that bulb only)
- you do the interface Message from somewhere else, lets say, upon a hotkey press (in my example, is on the PlayerController)
- you make sure you do a “Message” call. in your screenshot, im not sure where you are doing the interface call, but your are not sending the Message. my guess is that wherever you are doing that “OnClick” event (a widget?) you are implementing the interface in that widget. you have to implement it on blueprint of the skeletal mesh, Compile (this is important, else it wont show), and do the Message call from the widget. Make sure there is a little envelop on the Interface Message (see the red circle on my “Show Widget”).
- on the target blueprint you implement the logic (as you did). also, your naming is wrong, it describes nothing about what the interface does, “Which weapon is in use?” would tell me its gonna return a Skeletal Mesh value, instead its equiping a weapon. it should be called “Equip Weapon”.
See this tutorial on blueprint communication by Epic. they explain how interfaces work (pretty much what i said here)
implement the interface ONLY on the blueprint that contains the Skeletal Mesh Component.
from widget, do the interface message, make sure it has the envelop on top of it
the problem is the interface. post screenshot. also, what is your native language? maybe i can explain myself better on it.
hi, I implemented the interface into the widget, the charcter and into the sword blueprint. i’m not sure I understand your answer. i passed the message to interface from inventory widget
i changed the code and i think that the problem is not in the interface.
now I use the interface only to give input and the sword still be unvisible
if you need, i post a screen
please, see the tutorial i linked and try to get the idea on interfaces. also, try to understand my explanation. the OnClicked event is calling the interface wrongly. all the logic is fine and should work but you are basically telling your widget to execute the EventWhichWeaponIsEquipped; you are telling your widget to equip a weapon (yes, the Widget will equip a sword, which makes no sense). see my screenshot and see the differences.
and…sorry, i made a mistake (i made my screenshot too fast). when using interface, you need to know who you are sending the Message to. in your case, you need to target the Message to your bp_pawn (my screenshot shows no target on the interface).
thank you very much. I try later, and repost the result
IT WORKS. thanks so much for your patience.
glad you got your answer