error CS0120: An object reference is required

Assets/Scripts/BasicMover.cs(9,28): error CS0120: An object reference is required to access non-static member `UnityEngine.GameObject.transform’

I’m trying to write a script that will simply rotate the object around the Y axis. But I get this error code. How do I fix that?

An object reference is required to access non-static member
UnityEngine.GameObject.transform
Your code probably looks like this:

GameObject.transform.Rotate(0, 360 * Time.deltaTime, 0);

GameObject is a class identifier.

You most likely wanted to access the GameObject on your script. There is a property called gameObject (note the lower case g, not upper case G).

gameObject.transform.Rotate(0, 360 * Time.deltaTime, 0);

And if you did that, you could also shorten the access by not using gameObject to begin with:

transform.Rotate(0, 360 * Time.deltaTime, 0);

Or, perhaps you made a static method which access a non-static member (transform):

static void ThisWillFail()
{
    // Error, transform is not static!
    transform.Rotate(0, 360 * Time.deltaTime, 0);
}

In that case, remove the static modifier from the method:

// Removed 'static', now this method works.
// However, if static methods were using ThisWontFail, (previously called ThisWillFail) 
// now *they* will fail instead.
void ThisWontFail()
{
    transform.Rotate(0, 360 * Time.deltaTime, 0);
}

If this is the case, consider making all your methods non-static along the chain - or provide a reference to the object you want to use (transform in this case);

// Now, our caller must pass a transform argument.
static void ThisWontFail(Transform transform)
{
    transform.Rotate(0, 360 * Time.deltaTime, 0);
}