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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

NetworkConnection.SetChannelOption returning false

Discussion in 'Multiplayer' started by Paprik, Feb 21, 2018.

  1. Paprik

    Paprik

    Joined:
    May 25, 2014
    Posts:
    14
    We tried increasing the ChannelOption.MaxPendingBuffers option for the 0 and 1 default channels but SetChannelOption returns false without any documentation as to why.

    Why is the option not being set properly?

    Code (CSharp):
    1. public override void OnClientConnect(NetworkConnection conn)
    2. {
    3.             base.OnClientConnect(conn);
    4.  
    5.             // increase channel buffers
    6.             var x = conn.SetChannelOption(0, ChannelOption.MaxPendingBuffers, 64);
    7.             var y = conn.SetChannelOption(1, ChannelOption.MaxPendingBuffers, 64);
    8. }
     
    YiHan-GI likes this.
  2. YiHan-GI

    YiHan-GI

    Joined:
    Mar 20, 2018
    Posts:
    9
    I know this topic is quite old, but I am having the same problem.
    Edit: And now I found out what was wrong:
    Did you add any channel during configuring the server?
    Code (CSharp):
    1. ConnectionConfig connectionConfig = new ConnectionConfig();
    2. this.channelId = connectionConfig.AddChannel(QosType.ReliableSequenced);
    Use this channelId for SetChannelOption.
     
    Last edited: Nov 10, 2022