IsOwner property not recognised in script

I get “The name ‘IsOwner’ does not exist in the current context” when using it. Using NetworkObject.IsOwner i get “An object reference is required for the non-static field, method, or property ‘NetworkObject.IsOwner’” but VS will find it as a bool correctly.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Netcode;

public class NewBehaviourScript : MonoBehaviour {
    void Update() {
        if (IsOwner) {
            Debug.Log("Owner");
        }
    }
}

Im using unity 2020.3.27 and network objects for gameobjects 1 pre 5

You have a Monobehaviour that is trying to access something that is only available in the NetworkObject class. Because the field is not static but is different for every gameobject with a NetworkObject script, you need to inherit from a different class like NetworkBehaviour (which also has this) or attach a NetworkObject script and get this component.