ChatBehaviour.OnStartAuthority()': no suitable method found to override.

I am following a tutorial by dapper dino about using mirror chat system.(

) I followed to end but there is an error Assets\Chat\Scripts\ChatBehaviour.cs(14,26): error CS0115: ‘ChatBehaviour.OnStartAuthority()’: no suitable method found to override. I am using unity version 2021.2

using Mirror;
using System;
using TMPro;
using UnityEngine;

public class ChatBehaviour : MonoBehaviour
{
    [SerializeField] private GameObject chatUI = null;
    [SerializeField] private TMP_Text chatText = null;
    [SerializeField] private TMP_InputField inputField = null;

    private static event Action<string> OnMessage;

    public override void OnStartAuthority()
    {
        chatUI.SetActive(true);

        OnMessage += HandleNewMessage;
    }

    [ClientCallback]
    private void OnDestroy()
    {
        if (!hasAuthority) { return; }

        OnMessage -= HandleNewMessage;
    }

    private void HandleNewMessage(string message)
    {
        chatText.text += message;
    }

    [Client]
    public void Send(string message)
    {
        if (!Input.GetKeyDown(KeyCode.Return)) { return; }

        if (string.IsNullOrWhiteSpace(message)) { return; }

        CmdSendMessage(message);

        inputField.text = string.Empty;
    }

    [Command]
    private void CmdSendMessage(string message)
    {
        RpcHandleMessage($"[{connectionToClient.connectionId}]: {message}");
    }

    [ClientRpc]
    private void RpcHandleMessage(string message)
    {
        OnMessage?.Invoke($"\n{message}");
    }
}
1 Like

oops, wrong video

i mean this video, maybe

just use NetworkConnectionToClient instead of NetworkConnection and the problem should be solved.
public override void OnServerAddPlayer(NetworkConnectionToClient conn){}

Its a monobehaviour, not NetworkBehaviour