How would I go about create multiple cursors controlled by multiple players

I’m trying to recreate (What I thought would be a very easy system). I simple want to have multiple cursor controlled by multiple players using either the keyboard and mouse or gamepads. A reference is the system in Ultimate chicken horse. I’ve so far managed to be able to move two UI objects using a mouse to control one and a gamepad to control the other but the issue here is only one will be able to detect button clicks as it is the actual mouse!

I’m sure I’m just thinking about this wrong so I will keep trying but any advice to rattle my brain would be appreciated!!

Thankyou very much.

You can manually trigger event system events using ExecuteEvents. You’ll wanna make a new pointer event data object, give it the position of your FAKE cursor, raycast for all UI elements at its position then, if clicking, trigger the pointer click handler. See the code below for a bit of an example:

var pointer = new PointerEventData(EventSystem.current) {position = transform.position};

List<RaycastResult> raycastResults = new List<RaycastResult>();
_graphicRaycaster.Raycast(pointer, raycastResults);

foreach (RaycastResult raycastResult in raycastResults)
    var ui = raycastResult.gameObject.GetComponent<UIBehaviour>();
    if (ui)
        if (Input.GetKeyDown(KeyCode.Space))
            Debug.Log($"Clicked on {raycastResult.gameObject}");
            ExecuteEvents.Execute(raycastResult.gameObject, pointer, ExecuteEvents.pointerClickHandler);

You’ll have to get the graphic raycaster from the canvas your cursor is on and probably want to change the get space bar down check to whatever your cursors controller offers :slight_smile: