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

'TestClass.NetworkStart()': no suitable method found to override [Assembly-CSharp] csharp(CS0115)

Discussion in 'Netcode for GameObjects' started by cossacksman, Jul 28, 2021.

  1. cossacksman

    cossacksman

    Joined:
    Dec 2, 2017
    Posts:
    10
    Apparently, my tiny test class inheriting NetworkBehaviour does not contain an overridable method for NetworkStart, despite what's stated in the docs. Not sure what to do about this?


    Code (CSharp):
    1. using UnityEngine;
    2. using MLAPI;
    3.  
    4. public class TestClass : NetworkBehaviour
    5. {
    6.     public override void NetworkStart()
    7.     {
    8.     }
    9. }
    10.  
    Code (CSharp):
    1. #region Assembly Unity.Multiplayer.MLAPI.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
    2. // Unity.Multiplayer.MLAPI.Runtime.dll
    3. #endregion
    4.  
    5. using System.IO;
    6. using MLAPI.Messaging;
    7. using MLAPI.Serialization;
    8. using UnityEngine;
    9.  
    10. namespace MLAPI
    11. {
    12.     public abstract class NetworkBehaviour : MonoBehaviour
    13.     {
    14.         protected __RpcExecStage __rpc_exec_stage;
    15.  
    16.         protected NetworkBehaviour();
    17.  
    18.         public NetworkManager NetworkManager { get; }
    19.         public bool HasNetworkObject { get; }
    20.         public NetworkObject NetworkObject { get; }
    21.         public bool IsOwnedByServer { get; }
    22.         public bool IsOwner { get; }
    23.         public bool IsLocalPlayer { get; }
    24.         public ulong NetworkObjectId { get; }
    25.         public ulong OwnerClientId { get; }
    26.         public ushort NetworkBehaviourId { get; }
    27.         protected bool IsServer { get; }
    28.         protected bool IsClient { get; }
    29.         protected bool IsHost { get; }
    30.  
    31.         public virtual void OnGainedOwnership();
    32.         public virtual void OnLostOwnership();
    33.         public virtual void OnNetworkDespawn();
    34.         public virtual void OnNetworkObjectParentChanged(NetworkObject parentNetworkObject);
    35.         public virtual void OnNetworkSpawn(Stream stream);
    36.         public virtual void OnNetworkSpawn();
    37.         protected NetworkBehaviour GetNetworkBehaviour(ushort behaviourId);
    38.         protected NetworkObject GetNetworkObject(ulong networkId);
    39.         protected NetworkSerializer __beginSendClientRpc(uint rpcMethodId, ClientRpcParams clientRpcParams, RpcDelivery rpcDelivery);
    40.         protected NetworkSerializer __beginSendServerRpc(uint rpcMethodId, ServerRpcParams serverRpcParams, RpcDelivery rpcDelivery);
    41.         protected void __endSendClientRpc(NetworkSerializer serializer, uint rpcMethodId, ClientRpcParams clientRpcParams, RpcDelivery rpcDelivery);
    42.         protected void __endSendServerRpc(NetworkSerializer serializer, uint rpcMethodId, ServerRpcParams serverRpcParams, RpcDelivery rpcDelivery);
    43.  
    44.         protected enum __RpcExecStage
    45.         {
    46.             None = 0,
    47.             Server = 1,
    48.             Client = 2
    49.         }
    50.     }
    51. }
     
  2. luke-unity

    luke-unity

    Joined:
    Sep 30, 2020
    Posts:
    306
    It looks like you have our develop version of MLAPI. We are changing NetworkStart to OnNetworkSpawn with our next version. I'd recommend to use the 0.1.0 version if you are just starting with MLAPI because the docs match that version and it's overall much more stable: https://docs-multiplayer.unity3d.com/docs/migration/install
     
  3. cossacksman

    cossacksman

    Joined:
    Dec 2, 2017
    Posts:
    10
    Ah, I did migrate to 0.2.0 on the develop branch for a little while but reverted the package back to 0.1.1; it seems something didn't go quite right in that process.. I was curious when I was giving the Develop branch a go what the replacement for NetworkStart was but yes, I think I'll be sticking with the releases for now.

    Thanks for clearing that up!