I’m using a world space canvas with a custom world space cursor I made for a VR project (just a cursor graphic pushed around by the mouse scroll values). Using the graphic raycaster, I determine which UI elements are underneath the cursor, and using ExecuteEvent I simulate clicks on those elements.
The issue I’m running into is that the slider UI component doesn’t seem to respond to triggering “click” events on it. I’m specifically calling Execute with ExecuteEvents.pointerClickHandler on it and producing no effect.
Does anyone know how to get this thing to slide, aside from clicking on it with the actual mouse cursor?
I ended up going with a hacky approach that works. I look at the gameObject.name of the raycastAll results and if the object is a slider background, find the handle, position it to the mouse pointer, compare the position of the handle with the position and width of the slider to determine the percentage of the whole the slider is slid, multiply that by the max value, and set the slider to that value.
That way each slider can have different “onValueChange” handlers and I can treat them all the same. My code looks like this: