Player Input Manager: How get the PlayerInput object that was just spawned?

I have my Player Input Manager’s Notification Behavior set to “Invoke Unity Events”.
I assigned a script and method to Player Joined Event, called onPlayerJoined. This event fires when a new input device presses a button, but I need to get that Input Device instance from within the onPlayerJoined method. How do I do this? I tried adding a PlayerInput parameter to the method, but it comes back as null. What am I doing wrong? Or, what is the proper way to add a parameter to this event?

I had a similar problem, setting up the save rebinding, which also references the PlayerInput object.

simply, on your player object

  1. Add Component > Player Input

  2. plug your PlayerInputActions into the Actions

  3. then set up the reference in your script

      PlayerInput playerInput;
    

    void Start()
    {
    playerInput = GetComponent();
    }

    void SaveUserRebinds()
    {
        var rebinds = playerInput.actions.SaveBindingOverridesAsJson();
        PlayerPrefs.SetString("rebinds",rebinds);
    }
    

I think I may have deleted the PlayerInput component after I generated the C# PlayerInputActions Class??