Jump to content

Asking Unity to give you just key events that nobody else consumes.


Recommended Posts

So, if you have a MonoBehaviour, it can ask Unity to inform it about all keyboard events, and when you are told about a keyboard event you can choose to:

  • ignore it, or
  • do something with it, and consume it, or
  • do something with it, and don't consume it so it can still be passed on to other parts of the game

What is the best way to tell Unity I'd like to be lastmost in the key processing order, such that I want to give all other mods (and stock) "first dibs" on consuming the key event so I won't be told about it if they consume it?

This is so I can make it possible for people using kOS to catch any keypress that occurs "outside" the terminal window UNLESS that keypress is used by something else first.  (i.e. it can't read "W" because "W" will be consumed by stock, making it pitch down the vessel.)  Thus people could make a kOS script that triggers a bit of code based on a key you can hit during flight without having to shift focus to the terminal window first to do it.  (But I don't want to be rude to other mods and steal keypresses away from them).

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...