- Inuyasha123
- Posts: 19
- Joined:
Unity3D cannot use the mouse click control when displaying multiple screens
When Unity is running on multiple screens, I can't hit the control with the mouse, so I added the following code under NoesisView.cs. Sorry, I changed the code.
Because Unity will display these screens as a whole when displaying multiple screens at the same time, your mouse coordinates are the coordinates in this large screen.
If I want to click on the control, I will do the following operation
If the runtime changes the value of Camera's targetDisplay, the offset becomes the wrong value.
Because Unity will display these screens as a whole when displaying multiple screens at the same time, your mouse coordinates are the coordinates in this large screen.
Code: Select all
private float offset;
void Start()
{
offset = MultiScreenPosition();
}
public float MultiScreenPosition()
{
float offset = 0.0f;
#if !UNITY_EDITOR
int targetDisplay = _myCamera.targetDisplay;
for (int i = 0; i < targetDisplay; i++)
{
Display display = Display.displays[i];
if (display != null)
{
offset += display.renderingWidth;
}
}
#endif
return offset;
}
Code: Select all
_mousePos = UnityEngine.Input.mousePosition;
_mousePos.x -= offset;
UnityEngine.Vector2 mouse = ProjectPointer(_mousePos.x, _mousePos.y);
Re: Unity3D cannot use the mouse click control when displaying multiple screens
Could you please open a ticket about this? Thanks!
- Inuyasha123
- Posts: 19
- Joined:
Re: Unity3D cannot use the mouse click control when displaying multiple screens
@
With different resolutions the hover Events and click events are not working properly
At the end what happened with this one, we are in the same boat.Thank you!
With different resolutions the hover Events and click events are not working properly
Re: Unity3D cannot use the mouse click control when displaying multiple screens
This was never reported in the tracker, could you please file a ticket about it? Thank you
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 43 guests