Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Emulate multiple display input using GameViews
Vector3 RelativeMouseAt()
{
var mouseOverWindow = EditorWindow.mouseOverWindow;
System.Reflection.Assembly assembly = typeof(UnityEditor.EditorWindow).Assembly;
Type type = assembly.GetType("UnityEditor.PlayModeView");
int displayID = 0;
if (type.IsInstanceOfType(mouseOverWindow))
{
var displayField = type.GetField("m_TargetDisplay"BindingFlags.NonPublic | BindingFlags.Instance);
displayID = (int)displayField.GetValue(mouseOverWindow);
}
var pos = Input.mousePosition;
pos[2= displayID;
return pos;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment