Help

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class scripts : MonoBehaviour {
public UnityEngine.UI.Text gpc;
public UnityEngine.UI.Text foodDisplay;
public float food = 0.00f;
public int foodPerClick = 1;

void Update() {
    gpc.text = "GPC: " + foodPerClick;
    foodDisplay.text = "food: " + food;

   
}

public void Clicked() {
    food += foodPerClick;

}

}
the line gpc.text = "GPC: " + foodPerClick; does not work. Can someone help?

What code format is this? and can you have link to the lesson number.

I have two questions

  1. Is "GPC: " defined
  2. is it supposed to be inside quotation marks

The OP code looks like either .NET or C#. Neither of these are taught here.

what do you mean with defined?
and it is C#

Is "GPC: " a variable and if it is, is it defined, if it is not, what is GPC representing

https://www.google.ca/search?q=gpc+C%23

General Polygon Clipper

Again, related to C#.

ohh I am sorry… it is just that i could not find any help…

No harm done, and no need to apologize. There may well be somebody who is informed of C# who could help. Its not being on the curriculum kind of stacks things against your getting any help here, though it is not outside the realm of possibility.

hmm, it might be a unity thing as well, because i followed a youtube guide, and only changed a few words

1 Like