Search Unity

[request] tutorial or guide on how to use the new multiplayer event system?

Discussion in 'Input System' started by GilbertoBitt, Aug 30, 2019.

  1. GilbertoBitt

    GilbertoBitt

    Joined:
    May 27, 2013
    Posts:
    111
    i'm trying to get it working but i'm having some headache about it. how i setup and how i use it? i need a event system in scene or i need the new ui event system i don't really get it. pls help?

    PS: if i find the solution i post here to anyone with the same question.
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    @jonas-echterhoff is the expert here.

    Should be enough to replace the default EventSystem with MultiplayerEventSystem, setting its playerRoot to the root UI object that is to receive input for the player, and then linking PlayerInput to the InputSystemUIInputModule.

    In this setup you should be able to spawn one complete set (event system + ui module + ui + PlayerInput) for each player and the respective UI should be constrained to the user.

    We don't yet have good docs or even a sample for this AFAIK. Probably won't happen for 1.0 unfortunately. But hopefully once 1.0 is out.
     
    GilbertoBitt likes this.
  3. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
  4. usersoup

    usersoup

    Joined:
    Mar 14, 2019
    Posts:
    1
    If I were to use the generated script, would I not have to use to setup mentioned above?
     
    GilbertoBitt likes this.
  5. miqvp22

    miqvp22

    Joined:
    Jan 17, 2019
    Posts:
    9
    I made a tutorial covering this.

     
    ramchale, Filip8429, Roboserg and 3 others like this.
  6. pfnienow69

    pfnienow69

    Joined:
    Apr 27, 2020
    Posts:
    1
    Dear Sirs, especially Jonas and Rene, I am very grateful for the many explanations you make about Unity.

    I inform you that my English level is not so good ...

    That done, I would really like your help regarding the Multiplayer Event System, as I am working on a project for 4 local players, and I don't know how to change the First Selected and Player Root by the script. In fact, the player's prefab ends up losing these components when pointed to by the Inspector tab.

    I have read all Unity standards (manuals) in this regard and I have already reviewed several sites and found no solution.
    Please help. If possible, with a simpler programming approach (an example would be great).

    Strong hug and thank you!

    pfnienow@hotmail.com
     
  7. shaq145

    shaq145

    Joined:
    Jan 23, 2017
    Posts:
    8
    I've watched your video and I found out that I don't have a MultiplayerEventSystem. I followed your tutorial.
    I'm using Unity 2019.1.12f1
    Please help.
     
  8. Fenrisul

    Fenrisul

    Joined:
    Jan 2, 2010
    Posts:
    618
    Update your InputSystem package to the latest using PackageManager. I'm not 100% sure whether or not 2019.1 supports the 1.0.0 release, but it probably does.
     
  9. shaq145

    shaq145

    Joined:
    Jan 23, 2017
    Posts:
    8
    Thank you. Its all working now. The problem is that Unity 2019.1 doesn't support it that's why I upgraded to Unity 2019.3 but I have another problem including the UI again. Whether I move my mouse, click, or anything else, this error pops out in the console.

    MissingMethodException: UnityEngine.InputSystem.UI.InputSystemUIInputModule.OnRightClick Due to: Attempted to access a missing member.
    System.RuntimeType.InvokeMember (System.String name, System.Reflection.BindingFlags bindingFlags, System.Reflection.Binder binder, System.Object target, System.Object[] providedArgs, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, System.String[] namedParams) (at <437ba245d8404784b9fbab9b439ac908>:0)
    UnityEngine.SetupCoroutine.InvokeMember (System.Object behaviour, System.String name, System.Object variable) (at <480508088aee40cab70818ff164a29d5>:0)
    UnityEngine.InputSystem.LowLevel.<>c__DisplayClass7_0:<set_onUpdate>b__0(NativeInputUpdateType, NativeInputEventBuffer*)
    UnityEngineInternal.Input.NativeInputSystem:NotifyUpdate(NativeInputUpdateType, IntPtr)
     
  10. LiquidPenguin

    LiquidPenguin

    Joined:
    Apr 26, 2013
    Posts:
    1

    Hi, I had the same problem, just remove the PlayerInput component from the MultiPlayerEventSystem, it worked form.

    But one player can access the other player UI, anyone know how to fix this?
     
    Marhaikal likes this.
  11. Marhaikal

    Marhaikal

    Joined:
    Apr 20, 2017
    Posts:
    17
    Same thing is happening to my setup. PlayerOne can access PlayerTwo's UI. Did you find any solution?



    Thank you.
     
  12. Marhaikal

    Marhaikal

    Joined:
    Apr 20, 2017
    Posts:
    17
    I think i've found the solution. I manually assign Explicit Navigation for each of my UI slots. And prevented player1 from moving into player2's inventory UI. I geuss Unity designed this new Multiplayer System to work this way for scenarios like choosing a player in a fighting game where there's only 1 UI.
     
  13. lejean

    lejean

    Joined:
    Jul 4, 2013
    Posts:
    392
    Ye this has always been a big issue.
    If you use horizontal or vertical navigation it works, but once you go in 2 dimensions you got a problem.

    Another problem is that explicit navigation doesn't scale.
    So if you instantiate your buttons manually, you're screwed.
    You can script the connections on instantiate if you know the amount of columns but it's just a mess.

    I don't get why they can't just add a toggle to keep the navigation within a panel or something.
     
  14. Filip8429

    Filip8429

    Joined:
    Dec 16, 2018
    Posts:
    20
    When I add the MultiplayerEventSystem to a prefab and then instantiate it twice, it logs an error that there are two and I should be only using one even though, I don't have the simple EventSystem anywhere in my scene. Is this a bug? Does this only get logged because it extends from the original EventSystem? Looking at the code this seems like it but I didn't see this issue occur in other tutorials.
     
  15. joehirst92

    joehirst92

    Joined:
    Jun 1, 2019
    Posts:
    3
    Bump Filip8429 question
     
    Filip8429 likes this.