How to make a key press emulation on Unity in Unity? To respond to it and external programs. With the mouse, we can, for example, move as

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern int SetCursorPos(int x, int y); Vector2 mousePos; mousePos = new Vector2(1,2) 

And enter a key on the keyboard?

  • Maybe if you say why it is, then some solution will advise you. I can not imagine why this may need ... - Valera Kvip
  • @ValeraKvip Use Unity outside the Unity window. To be able to open other programs, find the desired shortcut on the desktop with the mouse. I understand, usually Unity is not used for this, but I would like to try all its features. According to your links there is a solution with downloading additional. - Dmitrii
  • This is already working with the OS. You can open different windows from VinForms. Unity is a game engine all the same. In general, everything is possible, but you need to go beyond the limits of the unit. - Valera Kvip
  • @ValeraKvip do you mean that units cannot do this? Or from a unit you can still press a key? You can use the mouse through working with user32.dll - Dmitrii

0