input handler on multiple objects?


I know it is pretty basic question… Just asking it anyways…

I use the Input.Getbuttondown on multiple objects. Like… My camera object uses teh button to switch from third person to Over-the-shoulder view… and in my player object to switch into Aim-mode… Each has it’s own flag…
Is it economical to handle the Input in one common place (UI manager?) and expose functions in these two objects to handle the keypress? Or, each object script check for keypress on it’s own.?

IMO there is advantages in both methods… If i handle in common place, I get reference to all functionalities in one place… Otherwise, i keep them all private, nice and clean…


Efficiency wise I don’t think it makes a difference, but I could be wrong. Separating the Input could possibly lower performance since you are running more Update methods.

Personally, I like to make an EventHandler script to take care of all my player input. I feel like it is easier to debug since you know where all of the actions are processed.