Interact ability no longer works after integrating Unity Input System

Savo

New member
I ran into a snag this weekend when I was setting up split-screen in my game where the interact ability on my doors no longer works. By that I mean, the text which says "Open" in the GUI when I am in the trigger zone, along with the button down does not trigger the interaction script.

Steps take to run into this issue:
  1. Followed the steps outlined here: https://opsive.com/support/documentation/ultimate-character-controller/camera/split-screen/
  2. When indicated, I downloaded the Ultimate Character Controller Integration and unpacked the unity package file into my project.
  3. Set up the two characters with the new Player Input and added the "Actions" with the provided "CharacterInput (InputActionAsset)" file.
    • I should say at this point everything appeared to work correctly. I could walk around with my two characters, the cameras would follow them, and the UI appeared to react to each player appropriately.
  4. Walked up to a door using the Interact Ability I set up before using this integration.
  5. No "Open" text or activity when pressing the assigned "Action" button.
Other information
  • I did create a custom interaction script following the video tutorial for interaction abilities.
  • I am using both Keyboard and Gamepad to test with.

If there's any more information that might be helpful in troubleshooting this issue, I will gladly provide.
 
So all of the other UI elements respond appropriately? Did you assign the Character field to the MessageMonitor?
 
Hi Justin,

Thank you for the reply. The message monitor in the GUI has been assigned the character:
1658156720700.png

My GUI use is quite simple at this time in that I have a flashlight as the only item in my character's inventory (not ultimate inventory system) and the icon appears correctly in the corner for the selected item. Maybe not a great test, but it is appearing correctly, nonetheless.
 
That looks correct. So it was working correctly before the input system integration? The UI and input aren't aware of each other so I'm not sure why that would be the case.

Within the MessageMonitor does the character subscribe to the OnAbilityMessageCanStart event? If you set a breakpoint is the event received when it is sent within Ability.cs?
 
It was working before the input system integration and now I get no feedback out of the system, no errors, no warnings, it just acts as if their was no interaction set up on the trigger.

As for the MessageMonitor, I am going to say no, the character does not appear to subscribe to OnAbilityMessageCanStart event. With the break point in place and running up to the doorway, it doesn't hit the breakpoint where other breakpoints I have set in other scripts do. So it would seem as though it is not calling that part of the MessageMontior.
 
The breakpoint not hitting is a good starting point. Does MessageMonitor.OnAttachCharacter get called? This is what registers the event.

If OnAttachCharacter doesn't get called does CameraController.OnCameraAttachCharacter execute with the correct character?
 
Stepping through the code at run time, lines 66 and 67 are both hit.
1658377651519.png

Interestingly though, when I continue and let the game run, the above block is hit again, however it hits line 54 and then unregisters the same character. Not sure what that is about.

As for the OnCameraAttachCharacter, it is executed:
1658377850099.png

I hope this helps.
 
The unregistration is the cause. What is the callstack when the character is unregistered?
 
Here is the call stack when it hits the OnAttachCharacter for the unregister.
1658464645342.png
and here when it hits the unregister event:
1658464721494.png
 
Hmm, that callstack looks like it is the same. You assigned the character to each CameraController, correct? Can you pinpoint why the character is null in the second instance?
 
Thank you for helping direct my troubleshooting efforts, Justin. I will dig into this more over the week and and return with my findings.
 
Hi Justin. I wasn't able to determine why the unregistration happened. However, by rebuilding the character controller from the ground up I was able to resolve the issue. Not a great fix, but it worked.
 
Top