- Home /
Reset the last local players toggle button while keeping online players selection?
The server side of things seems to be working but local update of the toggle buttons is overwriting the entire toggle group instead of just the last button they specifically selected.
private Toggle lastSelectedBtn;
public void toggleSelection(Toggle clickedButton) //local
{
if(lastSelectedBtn != null){
lastSelectedBtn.interactable = true; //this is setting the entire toggle group to interactable rather then just the last local players selection.
}
ButtonSelectionCommand command = new ButtonSelectionCommand(null, clickedButton.gameObject.name, null);
OnSelection?.Invoke(clickedButton.gameObject.name);
lastSelectedBtn = clickedButton;
}
Any one know how to make sure I am only reenabling the local players previously selected toggle if they change their mind and not overwrite any other players selections? Preferably using built in unity ui Toogle or Button rather than making a custom multi-select button group from scratch.
If the buttons interactable bool is set off in the inspector before pressing play the button stays off while interacting with other buttons either remote or local but if the button is set to interactable false by a user during gameplay the local player can see other players selections until they make a selection of their own. That makes the other players button selections interactable again instead of just setting their selection.
Your answer
Follow this Question
Related Questions
I'm trying to toggle my in-game menu. 1 Answer
UI Button should stay highlighted on click 2 Answers
Toggle Button Question 0 Answers
GUI.Button Toggling Error 1 Answer
Toggle Button State On/Off 2 Answers