void SetInputChange() { if (!inputSender.IsConnected || remoteVideoImage.texture == null) { return; } inputSender.SetInputRange(remoteVideoImage); inputSender.EnableInputPositionCorrection(true); }
public static void SetInputRange(this InputSender sender, RawImage image) { // correct pointer position Vector3[] corners = new Vector3[4]; image.rectTransform.GetWorldCorners(corners); Camera camera = image.canvas.worldCamera; var corner0 = RectTransformUtility.WorldToScreenPoint(camera, corners[0]); var corner2 = RectTransformUtility.WorldToScreenPoint(camera, corners[2]); var region = new Rect( corner0.x, corner0.y, corner2.x - corner0.x, corner2.y - corner0.y ); var size = new Vector2Int(image.texture.width, image.texture.height); sender.SetInputRange(region, size); }