Hi, i am using this Blueprint in a button that moves a platform, when i use just one button in the level it work well, when i duplicate it only the last created button works. The one thats not working prints the "Open " and “Enter”, but not the “Done” after Exit of the Gate node.
I am using Unreal 4.27. the same code at UE5 works fine.
I called a cast to char in begin play of this blueprint.
The action button is a custom event that I call in the char blueprint when E key is pressed.
The char ref is valid and the lock boolean is true, everything before the exit of the gate works fine no matter how many instances of the blueprint I put of the level, just the exit pin doesn’t work.
Each instance of the button has a button number int variable, I put the blueprint I the level then I change the variable in details tab, then I have the platforms with the same method of ID, in unreal 5 I press the button 1 the platform 1 moves, I press button 2 platform 2 moves, in unreal 4.27 only button 2 works, if I put both platform the code 2 then button 2 moves both platforms. I am going to work right now, so if it take to long for me to answer again it’s because of that
Have you tried substituting the gate node for a branch? I mean create a bool that’s true on overlap and false on exit, then have your action button with a branch waiting to be executed to “enter” if the bool is true.
It will work the same, just that I’ve had similar problems when using gate node on multiple instances. This way you’ll make sure each instance works independent of each other, so if one works, all should work just as good.
is the button that gets the character input, the character just overlaps it, the overlap opens the gate, then if the character press “E” the ActionButton Event is called in all the buttons but just the overlaped one should execute the gate output, the ID system i told is not in there i made a mistake because i was not looking at the blueprint when answered that, the ID is only in the platform part that comes after the gate.
here is how i call ActionButton Event and how i link the player and the button blueprints
Thanks @Everynone , i was really trying to reference every button in the same variable, its solved now deleting the custom event and putting the keyboard input directly in the button, now when the player overlaps the button it enables the button input, and when it ends overlaping the button is disabled.
Think that what @Everynone was trying to say is that the input should be handled by the player and the item should be the one just waiting to be interacted with. Rather than overlap events to then wait for input, just have the player press E and trigger whats in front/close to do the trick. This will be usefull for everything that can be interacted with pressing E, not just the buttons.
Anyways, @Everynone please correct me if I’m assuming too much.
Little to add. Use an Interface rather than hard coded references. Cleaner, safer, more flexible.
You don’t really need IDs - the player selects an actor and interacts with that actor. Unless you’re making puzzles - then you absolutely do need some form of ID. Which I’d still send through the interface.
But there’s more than one solution. Choose the one that works for you
yeah, i could do it but for that o should make a variable to ID each instace of the button right?
is there any big performance diference the way you are sugesting and the way i did it? i dont know enough of unreal or programing in general to measure the code performance, i usually take the first aproach that comes to my mind and works haha.
Rather than performance, it’s quality of life. If you then decide to add a light that toggles when pressing E, by your logic you would need to add the E event to the light.
If the player just had the input event for E, all you have to do is on each press check if what’s in front (by a collision box, trace, proximity, etc) has the desired Interface, if it does then execute it regardless of what it is: if it’s a light, turn it on, if it’s a button, trigger it, etc… So you only have to do the press E logic once, and the rest is just wait to be triggered.
Fair enough, i am actually tired of editing lots of blueprints for every small change in the prototype, will try to be more polished with the code, this two quotes made my mind about it.