I was wondering if you have any suggestions on what the best way to go about making a system that allows for any BP to be “interactable”, meaning, the player can interact with it. And of course, different things happening depending on what object it is.
Currently I have an interface I just call iInteractable. Then the player checks if there’s any object close to him with that interface (and which is closest). If so, show the “Press X to use”-HUD and when pressing X, call the “Interact”-function on that object.
It works surprisingly well and I can use it on pick-ups and buttons alike. The problem I’ve run into is that I’m not sure how to deal with something needing to “turn off” afterwards. Like a button. Once pressed, it should no longer be interactable. I basically need the objects to have an active state.
Is there any way I can with an interface or something similar force a Blueprint to have a variable, like bActive?
I don’t mind changing my setup completely if you have some amazing suggestions. The reason I’m not doing it with inheritance is that I want to be able to make anything Interactable, so I can’t find a good structure hierarchically.