Type UnityEngine does not contain a definition for RPC

Hey i keep getting this error Type UnityEngine does not contain a definition for RPC
Im trying to create a muiltiplayer chat system watching this video Unity3D Networking 8: Simple Chat System - YouTube
but doesn’t seem to work here is the code
using System.Collections.Generic;
using UnityEngine;

public class Chat : MonoBehaviour
{
public List chatHistory = new List();

private string currentMessage = string.Empty;

private void OnGui()
{
    GUILayout.BeginHorizontal(GUILayout.Width(250));
    currentMessage = GUILayout.TextField(currentMessage);
    if (GUILayout.Button("Send"))
    {
        if (!string.IsNullOrEmpty(currentMessage.Trim()))
        {
            networkView.RPC("ChatMessage", RPCMode.AllBuffered, new object[] { currentMessage });
            currentMessage = string.Empty;
        }
    }
    GUILayout.EndHorizontal();

    foreach (string c in chatHistory)
        GUILayout.Label(c);
}

[RPC]
public void ChatMessage(string message)
{
    chatHistory.Add(message);
}

}

You are looking at an old Unity tutorial.

Depending on the Unity version you use, NetworkView.RPC is obsolete and thus, doesn’t work. If you really want to use RPCs, you will have to do it on a Unity 5.0 (or older) version of Unity.

Check the documentation : Unity - Scripting API: NetworkView.RPC


In order to create your chat system with newer versions of Unity, you will have to use the Unet system