What is cs0120 error

The original address: https://support.unity3d.com/hc/en-us/articles/206496883-What-is-CS0120-
symptoms
I got the following error on the Console:

Error CS0120: An object reference is required to access non-static member ‘__’

why
There are two situations that can cause this error, listed below:
This error occurs when ol> attempts to directly reference a non-static variable in a static method.


The error message given in this example is:

Error CS0120: An object reference is required to access non-static member ‘myscript.name’

This error occurs when ol> calls another non-static method in a static method.


The error message given in this example is:

Error CS0120: An object reference is required to access non-static member ‘myscript.methodb ()’

The solution

    CS0120 can be resolved by creating an instance that references this non-static variable:

    CS0120 can be resolved by creating an instance that references this non-static method:


For more information
https://msdn.microsoft.com/en-us/library/s35hcfh7.aspx

Read More: