Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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