Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question MultiplayerEventSystem Same UI BUG

Discussion in 'Input System' started by Deleted User, May 15, 2021.

  1. Deleted User

    Deleted User

    Guest

    Hi ! I have the same problem as the last guy who posted (and the one before, SAEM2710) in : https://forum.unity.com/threads/solved-multiple-eventsystem.512695/. (I am not digging up the post because it's solved)

    I really can't find any answer, to believe that's why all local co-ops have split menus or cursor like Super Smash Bros, if you know a solution to this problem i am interested ! Thanks !

    (In short, you can't create a character selection menu like Street Fighter, because when two selectors from each player cross, one causes the other to disappear. (Then it is not superimposed either, but that's another thing). I think this is a problem with the MultiplayerEventSystem ...)
     
    Last edited by a moderator: May 15, 2021
  2. Fenrisul

    Fenrisul

    Joined:
    Jan 2, 2010
    Posts:
    618
    Mm, this one is a bit trippy. Its not so much a Bug as much as things like Button, Toggle, etc, do not understand "Multiple event systems".

    You could create a reticle per player... ie the Selector Object here which is assigned from a manager when the player joins and the Player prefab is instantiated.

    upload_2021-5-16_14-54-2.png

    upload_2021-5-16_14-55-43.png

    The selector graphics are designed such that when they overlay they'll occupy different corners, but you get the idea.

    Code (CSharp):
    1. public class Player : MonoBehaviour
    2. {
    3.     public Transform selectorObject;
    4.     PlayerInput input;
    5.     EventSystem eventSystem;
    6.  
    7.     private void Awake()
    8.     {
    9.         input = GetComponent<PlayerInput>();
    10.         eventSystem = GetComponent<EventSystem>();
    11.     }
    12.  
    13.     private void Update()
    14.     {
    15.         selectorObject.position = eventSystem.currentSelectedGameObject.transform.position;
    16.     }
    17. }
     
  3. Deleted User

    Deleted User

    Guest

    Thanks for your answer ! I had so given up on the idea of one day receiving an answer to this question ! It's simple and efficient, but I have an error when the selector wants to change the button: MissingMethodException: UnityEngine.InputSystem.UI.InputSystemUIInputModule.OnMove Due to: Attempted to access a missing member. System.RuntimeType.InvokeMember

    Problem which is apparently related to having Input System UI Module with PlayerInput on the same gameobject ... How to do then ? (https://forum.unity.com/threads/uni...tsystemuiinputmodule-is-commented-out.885214/)

    I just made the error disappear by creating an EventSystem gameobject under the Player prefab where I moved the Input UI Module and the Multiplayer Event system inside, thanks !
     
    Last edited by a moderator: May 17, 2021
  4. Fenrisul

    Fenrisul

    Joined:
    Jan 2, 2010
    Posts:
    618
    Input Module would have an event for OnMove, which would clash with PlayerInput when it is set to InvokeUnityEvent or SendMessage mode. Putting it on a child object is definitely a good solution :)