Class MultiplayerEventSystem
A modified EventSystem class, which allows multiple players to have their own instances of a UI, each with it's own selection.
Namespace: UnityEngine.InputSystem.UI
Syntax
public class MultiplayerEventSystem : EventSystem
Remarks
You can use the playerRoot property to specify a part of the hierarchy belonging to the current player. Mouse selection will ignore any game objects not within this hierarchy. For gamepad/keyboard selection, you need to make sure that the navigation links stay within the player's hierarchy.
Properties
playerRoot
The root object of the UI hierarchy that belongs to the given player.
Declaration
public GameObject playerRoot { get; set; }
Property Value
Type | Description |
---|---|
GameObject |
Remarks
This can either be an entire Canvas
or just part of the hierarchy of
a specific Canvas
.
Note that if the given GameObject
has a CanvasGroup
component on it, its
interactable
property will be toggled back and forth by MultiplayerEventSystem.
If no such component exists on the GameObject
, one will be added automatically.
Only the CanvasGroup
corresponding to the MultiplayerEventSystem that is currently
executing its Update() method (or did so last) will have interactable
set to true.
In other words, only the UI hierarchy corresponding to the player that is currently running a UI
update (or that did so last) can be interacted with.
Methods
OnDisable()
Declaration
protected override void OnDisable()
OnEnable()
Declaration
protected override void OnEnable()
Update()
Declaration
protected override void Update()