(SOLVED)"public int score" not showing up in my inspector

I’ve spent about an hour trying to figure out why I am not able to get my “score” to show up in the inspector under my ScoreKeeper script. Here is my ScoreKeeper scripts:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class ScoreKeeper : MonoBehaviour {

public int score = 0f;

private Text myText;

void Start(){
	myText = GetComponent<Text>();
	Reset ();

public void Score(int points){
	score += points;
	myText.text = score.ToString ();

public void Reset(){
	score = 0;
	myText.text = score.ToString ();


Any help would be greatly appreciated!


You have declared score as an int, but you have added an ‘f’ after the zero as if it were a float.

Remove the ‘f’.

Thanks. I removed the “f” and saved my script and unfortunately I still don’t have the “score” showing up in the “inspector” under my “Score Keeper” script.

Any other thoughts?

Can you pop a screenshot up, with the game object the score keeper scriot is attached to select in the Hierarchy and the details viewable in the Inspector.

And another of the Project view with the ScoreKeeper.cs file selected please.

I just solved it! For some reason my Unity was not responding when I tried loading other scenes. I saved, shut down and reloaded the Unity and now my 'Score" is showing up in the inspector! Just needed a good reboot…

Thanks so much Rob for the fast responses…you ROCK! I’ll try to help others along the way when I can.


You’re welcome and well done for resolving it yourself. Glad you can continue with the course now. :slight_smile:

Me too. This course is amazing and I have already purchased the RPG one. Once I finish the basics here, it is off to more learning!


Privacy & Terms