- Home /
Duplicate Question
Error CS0120
I know it has been asked a lot, but I noticed that the answer was always different from the others, so I ask it with my code, because I haven't find the answer I need: I've got a script which has a variable "batteria" and this variable varies (well, being how much a battery will live, decreases) over time. I need to call that variable from a GUI script, so that the user can see it, but it tells me "An object reference is required to access non-static member `LightScript.batteria'". What should I do?
There are three things you need to do:
Refer to What are the c# error messages?
Post the properly formatted code with the question.
Post exact error message along with line numbers and other details or post screen shot of error console itself.
Yes, I looked around for another hour and found I could use, in the SecondScript, "FirstScript script = new FirstScript()", and then "variable = script.variableINeed"
Follow this Question
Related Questions
Error Code CS0118 or CS0120 1 Answer
Help with more code 2 Answers
error 0120 Help 1 Answer
BlockBreaker Tutorial: CS0120 Error. 0 Answers
error CS0120: An object reference is required to access non-static member 1 Answer