Quick answer: CS0120 means you asked a class for something that only its objects have. Transform.position names the Transform class; transform.position names this object’s transform. Use the lower-case inherited property, or get a reference to the specific component (a serialized field, GetComponent, FindFirstObjectByType) and call the member on that. Mark a member static only when one shared value for the whole game is what you want.

This error tends to arrive in the first week of Unity scripting and again whenever a script needs to talk to another script. The line looks reasonable, PlayerHealth.TakeDamage(10), and the compiler refuses it with a sentence about object references and non-static members. The fix the internet suggests first, adding static until the error stops, compiles and then breaks the Inspector and every scene with more than one of that object. This guide explains what the compiler is asking for, walks through the cases Unity developers actually hit with broken and fixed code, and covers when static or a singleton is the right answer.

The exact error

Assets/Scripts/Mover.cs(12,9): error CS0120: An object reference is required for the non-static field, method, or property 'Transform.position'

The quoted part is always Type.member, and for methods it includes the parameter types: 'GameObject.SetActive(bool)', 'PlayerHealth.TakeDamage(int)', 'ScoreKeeper.score'. It tells you which class the compiler thinks you addressed and which member needs an object. Like every compile error it shows in the Console as soon as scripts recompile, blocks Play mode, and fails a player build.

Instance and static in plain terms

A class is a description. Transform describes what every transform has: a position, a rotation, a parent. A scene contains hundreds of actual transforms, one per GameObject, each with its own position. Those are instances, and position is an instance member: the question “what is the position?” only makes sense when you say whose.

A static member belongs to the class itself. There is one copy and you need no object to use it: Time.deltaTime, Mathf.Clamp, Vector3.zero, Physics.Raycast. CS0120 is the compiler telling you that you used the static form, class name then dot, on a member that is not static.

How to tell which case you have

Read the quoted Type.member and ask which object you meant.

You meantTypical lineGo to
This object’s own transform or GameObjectTransform.position, GameObject.SetActive(false)Case 1
A component on this objectRigidbody.velocity, Animator.SetTrigger("Jump")Case 2
A script on another objectPlayerHealth.TakeDamage(10)Case 3
A field of this class, from inside a static methodscore += amount;Case 4
The one and only manager in the gameGameManager.AddScore(5)Static or singleton

If the line has no class name in front of the member at all, as in the fourth row, look at the method it sits in. The word static in that method’s signature is the cause.

Case 1: Transform.position and GameObject.SetActive

// Broken
void Update()
{
    Transform.position += Vector3.right * Time.deltaTime;   // CS0120: 'Transform.position'
    GameObject.SetActive(false);                             // CS0120: 'GameObject.SetActive(bool)'
}

// Fixed
void Update()
{
    transform.position += Vector3.right * Time.deltaTime;
    gameObject.SetActive(false);
}

Every MonoBehaviour inherits two lower-case properties: transform, the Transform of the object the script is on, and gameObject, the GameObject itself. The capitalised words are the class names. One letter of case decides between “this object’s” and “the class”.

Case 2: Rigidbody.velocity and other components

There is no working lower-case shortcut for other components. Fetch the component once and keep it in a field:

// Broken
void FixedUpdate()
{
    Rigidbody.velocity = Vector3.forward * speed;    // CS0120: 'Rigidbody.velocity'
}

// Fixed
private Rigidbody rb;

void Awake()
{
    rb = GetComponent<Rigidbody>();
}

void FixedUpdate()
{
    rb.linearVelocity = Vector3.forward * speed;     // Unity 6
    // rb.velocity = Vector3.forward * speed;        // 2022 LTS
}

Unity 6 renamed velocity to linearVelocity on Rigidbody and Rigidbody2D; the old name still compiles there with an obsolete warning. The same pattern applies to Animator.SetTrigger, AudioSource.Play, SpriteRenderer.color and Collider.enabled: declare a field of that type, assign it in Awake with GetComponent or through the Inspector with [SerializeField], and call the member on the field.

Case 3: calling another script through its class name

// Broken
void OnTriggerEnter(Collider other)
{
    PlayerHealth.TakeDamage(10);     // CS0120: 'PlayerHealth.TakeDamage(int)'
}

The compiler needs to know which player: the particular PlayerHealth component on a particular object. There are three sound ways to get it, in order of preference.

Take it from the object involved. In collisions and triggers, the thing you hit is handed to you:

void OnTriggerEnter(Collider other)
{
    if (other.TryGetComponent(out PlayerHealth health))
        health.TakeDamage(10);
}

Assign it in the Inspector. For links that are known while you build the scene:

[SerializeField] private PlayerHealth playerHealth;

void Explode()
{
    playerHealth.TakeDamage(10);
}

Search the scene once. For objects spawned at runtime that cannot be wired by hand:

private PlayerHealth playerHealth;

void Start()
{
    playerHealth = FindFirstObjectByType<PlayerHealth>();
}

FindFirstObjectByType is available in 2022 LTS and Unity 6 and replaces FindObjectOfType, which is marked obsolete in Unity 6. It searches the whole scene, so call it in Start and cache the result; never call it every frame. It returns null when nothing matches, and so does an Inspector field you forgot to fill. That is why the error people meet right after fixing CS0120 is a NullReferenceException.

Case 4: instance fields inside a static method

// Broken
public class ScoreKeeper : MonoBehaviour
{
    [SerializeField] private TMP_Text label;
    private int score;

    public static void AddPoints(int amount)
    {
        score += amount;                  // CS0120: 'ScoreKeeper.score'
        label.text = score.ToString();    // CS0120: 'ScoreKeeper.label'
    }
}

A static method runs without any object, so it has no this and no fields to read. Pick one:

Event handlers follow the same rule. A handler declared static void OnSceneLoaded(Scene scene, LoadSceneMode mode) cannot touch the component’s fields. Drop the static, subscribe in OnEnable and unsubscribe in OnDisable:

void OnEnable()  { SceneManager.sceneLoaded += OnSceneLoaded; }
void OnDisable() { SceneManager.sceneLoaded -= OnSceneLoaded; }

void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
    spawnPoint = GameObject.FindWithTag("Respawn").transform;
}

Methods Unity requires to be static, such as those marked [MenuItem] or [RuntimeInitializeOnLoadMethod], have to find or receive their instance; they cannot become instance methods.

A close relative is CS0236, A field initializer cannot reference the non-static field, method, or property 'Component.transform', from a line such as private Vector3 startPosition = transform.position; in the class body. Declare the field without a value and assign it in Awake.

When making it static is correct, and what it costs

Adding static to the field or method does make CS0120 go away. It is the right fix for constants, for pure helper functions that only use their parameters, and for data that is truly global, such as a score that must survive scene changes. For anything else it changes behaviour in ways that surface later:

The singleton: a static reference to one instance

When there is exactly one of something for the whole run of the game (a game state manager, an audio manager, a save system), a singleton gives you class-name access while keeping normal instance fields that the Inspector can show:

public class GameManager : MonoBehaviour
{
    public static GameManager Instance { get; private set; }

    [SerializeField] private int startingLives = 3;
    public int Lives { get; private set; }

    void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
            return;
        }
        Instance = this;
        Lives = startingLives;
        DontDestroyOnLoad(gameObject);
    }

    void OnDestroy()
    {
        if (Instance == this) Instance = null;
    }

    public void LoseLife() { Lives--; }
}

// From any script
GameManager.Instance.LoseLife();

The costs are real. Instance is null until that object’s Awake has run, so reading it from another script’s Awake can fail depending on execution order; read it from Start or later. Any script anywhere can change the manager’s state, which makes bugs harder to trace than with explicit references. And it locks you into one: a singleton Player is a rewrite the day you add local co-op. Do not use it for players, enemies, projectiles or anything else that could exist twice.

How to confirm the fix

The Console clearing only proves the code compiles. Every CS0120 fix replaces a class name with a reference, and a reference can be null, so test the behaviour:

  1. Enter Play mode and trigger each line you changed. Watch for NullReferenceException and UnassignedReferenceException.
  2. For new [SerializeField] fields, check the value is assigned on the prefab asset, not just on one instance in one scene.
  3. Put two of the object in the scene (two enemies, two pickups) and confirm that damaging one leaves the other alone. Shared state means a static slipped in.
  4. Reload the scene and return to the main menu and back. Singletons and statics show their problems on the second load.

What Bugnet sees after this fix

CS0120 never leaves your machine: the code does not compile, so there is no build and nothing for Bugnet to report. The follow-on errors are a different matter. A reference field left empty on one prefab variant, or a GameManager.Instance read before its Awake, throws at runtime only in the scene or the order of events that exposes it, which is often a path you did not test. The Bugnet Unity SDK captures those exceptions through Unity’s log callback and files each with its stack trace, recent log lines, platform, OS and game version, grouping repeats of the same message into one entry with a count. That tells you which reference is null and in which release. It will not tell you which Inspector slot to fill; the stack trace line gets you to the script, and the fix is still made in the editor. The SDK reference is at /docs/sdks.

Frequently asked questions

What does error CS0120 mean in Unity?

You used a member that belongs to individual objects as if it belonged to the class. Writing Transform.position names the Transform class, which has no position of its own. The compiler wants a specific object, such as transform.position for the object the script is attached to.

Why does Transform.position give an error but transform.position works?

Transform with a capital T is the class. The lower-case transform is a property every MonoBehaviour inherits that returns the Transform of its own GameObject. Position is stored per object, so it has to be read from a particular transform, not from the class.

How do I call a method on another script in Unity?

Get a reference to that script’s component first. Use a serialized field assigned in the Inspector, GetComponent or TryGetComponent on the object you collided with, or FindFirstObjectByType once in Start. Then call the method on that reference instead of on the class name.

Should I just make the method static to fix CS0120?

Only if it uses no per-object data. A static field is shared by every instance, is not shown in the Inspector, is not saved with the scene or prefab, and keeps its value across scene loads. For per-object state, get a reference instead.

When is a singleton a good idea in Unity?

When exactly one instance exists for the whole run of the game, such as an audio manager, a save system or a game state manager. Its Instance is null until its Awake runs, so read it from Start or later, and avoid it for anything that could exist twice.

The compiler is asking “which one?”. Answer with a reference to the specific object, and reach for static only when the honest answer is that there is one for the whole game.