Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Bug MLAPI Exception - "You must initialize the RpcQueueContainer before using MLAPI"

Discussion in 'Netcode for GameObjects' started by MomoThePopo, Jun 25, 2021.

  1. MomoThePopo


    Jun 3, 2017
    I've been trying to pick up MLAPI for the last week and I'm now working on a basic lobby/connection screen where you would be able to connect as client or as a host.
    My idea is to check if the player is running only as a client or as a Host. Then, there are 2 cases:
    1 - The host is trying to leave, then I want everyone to be disconnected from the server and update every client's UI accordingly.
    2 - only a client is leaving which doesn't require any networking other than NetworkManager.StopClient().
    That's what my ServerRpc function is trying to do: If we are a Server it calls a ClientRpc method to update UI for all connected clients, but when the method is called i get that exception and the UI doesn't update. I tried making the function that's wired to the button a regular function (not an rpc function) which does the "are we a server" check and then proceeds to call the serverRpc and ClientRpc accordingly, But I got the same error. what can I do ? thanks in advance :)
  2. unity_E9D42DA3C8666EF28C23


    Apr 29, 2021

    In my case I have a welcome server to managed players login, start game servers requested by the players, and then managed player list on each started game. When all players of a game are ready, they disconnect from welcome server to connect to the game server.
    To do that, when all players are ready, the Welcome server call "StartBattleClientRpc" on each client. If I call StopClient() from within the StartBattleClientRpc method I have an error and the client stop.
    I managed to make it works by using a coroutine to stop the Client on ne the next frame. And it works fine. Is it the good way to do that ? I don't know, but it's ok for a personal project.