Assets/Score.cs(19,25): error CS0120: An object reference is required to access non-static member `UnityEngine.Component.guiText'

using UnityEngine;
using System.Collections;

public class Score : MonoBehaviour {

static public int score = 0;
static public int highScore = 0;

static public void AddPoint(){

		highScore = score;

void Update () {
	GUIText.text =  "Score: " + score + "

High Score: " + highScore;ERROR



You’ve posted a couple of questions regarding the same error. The error is saying you need an object reference. You seem to understand what an int is, so I’ll try to explain with that.

int = 4;        // this will fail because the variable int hasn't been declared
int score = 4;  // this works, because "score" is the int

It’s the same idea with GUIText. You need to declare what GUIText is. Hook it up in the inspector.

public GUIText guiText;
void Update() {
    guiText.text =  "Score: ...";