Hi,
using a raycast inside scripts you can easily set the range - but how can i set the range of the Physics Raycaster component from the UI.dll?
The API just tells nothing.
Hi,
using a raycast inside scripts you can easily set the range - but how can i set the range of the Physics Raycaster component from the UI.dll?
The API just tells nothing.
The API docs don’t mention a way to set the range because there is no way to set the range. The GraphicsRaycaster
will raycast all UI in the scene.
The API just tells nothing.
As can be seen in the code, it’ll use the distance between near and far clipping plane.
float dist = eventCamera.farClipPlane - eventCamera.nearClipPlane;
You can create a new raycaster that expose a variable distance. You could just copy paste the code and change the class name to LimitedPhysicsRaycaster or whatever name you can come up with, and make distance public so you can set it.
When you have finished editing your class, chuck the old PhysicsRaycaster off your camera and put your own LimitedPhysicsRaycaster in its place. That should solve your problem.
The EventSystem will automagically pick it up because the BaseRaycaster will take care of registration for use with the EventSystem.