Toggle visibility between couch Blueprints

I have three Couch blueprints set to hidden at beginning of play. When the player overlaps a Trigger Box, BP_CouchSet_1 is unhidden. When the player presses 1-3 on keyboard, I want the corresponding Couch blueprints to become unhidden and the others to remain hidden, for example, the player presses 2, BP_CouchSet_2 is shown while BP_CouchSet_1 and BP_CouchSet_3 remain hidden, Please see my attempt at the Blueprint, all made within the TriggerBox BP. I cant get this right, when the player overlaps trigger box, the couchBp1 is shown, but when I press keyboard 1-3, nothing happens, should this code be in a separate BP to the TriggerBox BP.

This shouldn’t be super difficult to create:

  1. Create an event that listens for a keyboard input event, such as the “Key Event” node.
  2. Create a “Cast To” node that casts the player character to a reference to the player character’s Blueprint, so you can access the player’s variables and functions.
  3. Use a “Branch” node to test the value of the keyboard input, and based on the result, set a variable in the player character Blueprint that indicates which couch set should be shown.
  4. Create another event that listens for changes to the variable you set in step 3, and based on the value of the variable, use a “Set Visibility” node to show or hide the corresponding couch Blueprint.

Also, consider separating the logic for keyboard input and couch blueprint visibility into a separate Blueprint, as it makes the code easier to manage and maintain. This separate Blueprint can be called from the Trigger Box Blueprint using the “Event Dispatcher” node.

Note that this is just one way to implement this logic, and the exact implementation will depend on your specific use case.

My Solution was I needed to enable input and link that to GetPlayerController, so that I could then trigger the keyboard numbers

1 Like