The OnKeyChanged Event

cInput calls an event whenever either the ChangeKey() function which waits for player input, or the ResetInputs() function is called. Note that it will still be called in cases where the keys stay the same (such as from canceling a ChangeKey() action). An example for why you might want to use the OnKeyChanged event would be to run a function to update the text labels in a custom UI.

Here's some code showing one such example:

What's an Event?

If events are completely new to you, you may find Unity's training video on Events helpful.

Last updated