How to disable a widget from one pawn affecting the other pawn in the scene?

Hi everyone, I have an issue that I cannot figure out. I have a pawn with a compass widget. I do not want it to show up in the other pawn. Anyone knows how to do it in Blueprint? Both pawns are in the scene. Thank you!

Hi, both pawns meaning, you are able to switch to other pawn? and you don’t want to see compass widget? if yes, it depends where you have put the create widget and add to viewport logic of compass widget. if its in player controller, when you switch to other pawn, before switching, take the variable reference and set visibility to hide. If this is not pointing in right direction, if you can give more points, we can be a bit of more help

Hi Ram, I really appreciate your explanation. So currently I have two pawn blueprints in the scene. One is primary, which has all the widgets blueprints added to the screen, including the compass widget. The other secondary one has no widgets added like the primary at all. When I switch to the secondary pawn with a button, all the widgets still show up from the primary pawn. I was trying to add logic to hide the compass widget from the secondary pawn, but all the widgets hide from the primary as well. I assume the widgets in primary pawn affect the secondary somehow?

Should I move all the widget blueprints from primary pawn to player controller? I thought the pawn blueprints were all independent, when you switch pawns, it automatically disables the other pawn.

Or should I use an Actor blueprint instead of the pawn blueprint for secondary pawn? I am making the several views with spring arm and camera in the scene, when you click on it, it just switch the views.

Sorry I have so many questions on this. :sweat_smile:

hi, so its always better to put widgets logic in player controller. you can move the logic to player controller. You can cast to player controller and store a variable in event construct of widget and on button click of changing pawns, as widgets logic is in controller, you can set visibility to false of which ever we needed. if they are separate widgets, make sure to promote them to variables so as to play with their visibility.

Ah… I never thought about using player controller to have an overall widget blueprint then turn on/off in pawns. You are so so smart! I will give it a try. Thank you very much! :folded_hands:

Great, let us know if it works

Hi Ram,

I just want to give you an update after trying this and other methods. It did not work somehow.

I created a custom event and saved all the widget blueprints in the Player Controller. In one pawn blueprint, I casted the widget, and it showed up in another pawn viewport as well. I’m lost. Now my question is, is there a way to let widget only show in one pawn, not the rest of pawns in the scene? Or from the start, I am totally wrong with the logic? I have a main pawn controls the spring arm and camera, so you can rotate, zoom in/out and pan. Then another pawn is a hotspot, when you click it, it goes to that hotspot pawn camera view, and you can continue rotate and zoom around.

This is the custom events I created

This is one pawn casting it, and it showed up in other pawn screen as well.

  1. where is your pawn changing logic?
  2. promote all your widget variables after ‘create widget’ node
  3. create a custom event in player controller where you put these variables and drag from them, remove from widget or set visibility to hide maybe
  4. where you are changing pawn, add this new event also so that the logic is - when you change pawn, whatever widgets are created till then, they are removed or hidden from viewport - when you switch back to original pawn - you can create another event in controller where they are added again and call this event there

Happy Memorial Day by the way. Thanks so much for the response!

To answer your first question, the two pawn logics are in the button widget. I have a hotspot button, you click it, it changes the pawn.

I added hide widget event in the Player Controller, then trying to hide it in the pawn blueprint, it did not work and still showed the widget on both viewport. But, it worked when I put the logic in the hotspot button blueprint. I wonder why. There is really no logic node can control the pawns to show what you want it to show on viewport?

So in the end of day, I have to create all the widgets in the Player Controller, set show/hide for all. Then go to pawn to cast it, then use widget button to control visibility? I thought it would be really easy to do. What if I have 20 pawns in the scene, I have to manually set up all these? Sorry I’m too new on this. :cry:

happy memorial day to you too. by the way, i am telling multiple things and you are getting a bit confused i think. let’s go one by one only.

  1. target one widget only and promote it to variable (for now and testing purpose)
  2. create a event in player controller itself and add the logic of hiding it (send screenshot for us to see)
  3. the widget where you have the button to switch pawns, in event construct of it, cast to player controller and save it as variable
  4. now, on - on clicked event - of that button, take this controller variable and call the event we created in point 2
  5. and you should see pawn changed and one widget hidden till here
  6. let us know

This works. I made Step 1 and 2 in Player Controller here

Step 3, to call it in pawn blueprint, PC_Aerial is the Player Controller

Step4, I called the hide event in Player Controller, in the hotspot button widget blueprint

Not sure if the steps I followed are what you expected. If so, the Step 3 does nothing basically? It still works if I disconnected that event.

  1. don’t do step 3
  2. so now, if you see, you are changing the pawn and widget is also hidden
  3. how do you switch the pawn back? same hotspot button or some other button?

Yes. Thanks so much for guiding me with all the steps. I have a button that can switch back to the main pawn. I thought it would be some thing very simple, not jumping all over the different blueprints. I too underestimated the Unreal. :smiling_face_with_tear:

Now I have a new issue, that when I click the Exit button to go back to the main pawn. The Hotspot button (3D Widget) under the other pawn did not work anymore. I did set up visibility in the exit button, it showed in the main pawn, but no button function. My logic was wrong again? :grimacing:

hi firstly, can you confirm me one thing that

  1. hotspot button is for switching to 2nd pawn
  2. another button is for switching to 1st pawn right? and these two buttons are in same widget?

Hi Ram, thanks for responding so quickly!

  1. hotspot button is for switching to 2nd pawn - Yes
  2. another button is for switching to 1st pawn right - Yes

and these two buttons are in same widget - No. They are in two separate widget blueprints, totally independent. The hotspot button is called into Widget in the pawn. The other button is just the X button to quit from the 2nd pawn.

I also want to give a clue. If I did not set up the visibility in the X button, the hotspot button would not even show up. I guess when I possessed the 1st pawn, somehow the 2nd pawn in the scene did not activate at all?

I think we are close. now,

  1. when clicked on hotspot button, you are able to switch to 2nd pawn
  2. but when clicked on x button, you were not able to switch back to 1st pawn?
  3. or switching to 1st pawn is happening but the widget that you set visibility to hidden (when you click hotspot button) is not coming now (after clicking x button)? is this the problem?

Hopefully. Thank you so much as always! I don’t know how did you learn this thing. It has been a tedious journey so far. Not a lot of tutorials aiming your exact issues. AI can only give you sort of answers, most of time you have to figure out by yourself. Sometimes I get stuck for weeks to try to solve one issue. Sorry, back to your questions:

  1. when clicked on hotspot button, you are able to switch to 2nd pawn - Yes
  2. but when clicked on x button, you were not able to switch back to 1st pawn? - No, I still can switch back to 1st pawn
  3. or switching to 1st pawn is happening but the widget that you set visibility to hidden - Yes, after I set the visibility, I can still see the hotspot button, but not able to click to switch back to 2nd pawn again. If I start over, it works again, just failed at 2nd attempt, after you go to the 2nd pawn, then go back to 1st pawn, it lost the button function setup.

understood, so first time its working ok, but second time you were not able to switch back to 1st pawn. for that, please share whole logic screenshot of your hotspot button click event so that some route we can think of. and also share your x button logic also. something to do with possessing logic i think.

not able to click? or you are clicking and things are not happening? maybe a video attachment will also help

This is the video, showing OK with the level just started, but hotspot button did not work after switching the pawn at the end.

This is the hotspot blueprint, the reference POI_Pawn_Hotspot is the 2nd pawn with the hotspot widget in it.

This is the X button quitting hotspot pawn, the reference BP_OrbitCamera is the main pawn to start with the level.