No event handlers shown in UI - 0.2.8

I’ve attached my Player Input to my camera GameObject, selected Invoke Unity Events. I’ve created a script called CameraManager that implements the interfaces for my action maps and defines my event handlers, e.g. public void OnOrbit(InputAction.CallbackContext context) However, in the UI for the Player Input, when I expand Events and attach the CameraManager script to the CameraNavigation/Orbit Action there are no functions shown in the function drop-down list. I only see “No Function” and “MonoScript”.

Is there a step somewhere that I’ve missed?

I’ve tried with and without CameraManager attached to the camera GameObject, and I’ve tried removing the interfaces and renaming the handlers to just e.g. Orbit, following the example at InputSystem/Packages/com.unity.inputsystem/Documentation~/QuickStartGuide.md at develop · Unity-Technologies/InputSystem · GitHub.

Thanks.

I figured out the step I missed. The object I needed to attach to the Player Input was a GameObject that had the script implementing the event handlers attached to it. In my case it happened to be the same object the Player Input is attached to:

Camera → Player Input → Camera → Script with event handlers

Keeping in mind that I’m coming from a background in traditional development (enterprise-class line-of-business applications, so dependency injection, lots of abstractions, asynchronous messaging, unit tests, etc.), just a few comments:

  • I’ve come to terms with the fact that the UI/editor is basically the composition root. Sort of. I’m not happy about it, but it is what it is.
  • Attaching scripts to objects seems at times to be rather arbitrary. Generally, there’s no natural GameObject the player input belongs on (I suppose if you have a player, but what about the inputs that affect the global environment?). I added it to the camera because in this case what I’m manipulating is the camera (you could say the camera is my “player”). The event handlers also seem to make sense on the camera, but now it looks like I’ve got a circular reference. It seems to me it would be beneficial to be able to directly reference a class from the Player Input that provides the event handlers without having to reference it through a GameObject. Or, if the GameObject the Player Input is attached to already has a script attached that implements event handlers, allow us to reference those.
  • I’m really liking the new input system. It naturally encourages better separation of concerns and results in cleaner, easier to maintain code, the requirement to “attach” the script to an arbitrary GameObject notwithstanding.

I do recognize that this is preview technology, and therefore not fully polished or finished, but that’s why I figured it would be a good time to provide some feedback. It’s not a complaint, but some suggestions to improve it.