-
-
Save ikriz/ad17a2c2d803d15b1777590fb29dc4d3 to your computer and use it in GitHub Desktop.
Emulate multiple display input using GameViews
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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