How can I reference another class's public field/Property

I’m trying to follow the documentation here: Accessing Other Game Objects

I have class A which has

using System.Runtime.InteropServices;
using UnityEngine;
using System.Collections;

public class GUITimer : MonoBehaviour
{
    private bool gameStart;

    public bool GameStart
    {
        get { return gameStart; }
        set { gameStart = value; }
    }

}

And then I have Class B which has

public class voteSprite : MonoBehaviour
{
    public GUITime guiTimer;

	void Start ()
	{
	    guiTimer = GetComponent<GUITimer>();
	}

	void Update()
        {
        }
}

Class A (GUITimer), is added to an empty game object as a component, and Class B (voteSprite) is added to a sprite as a component.

I then added the game object with the GUITimer script into the text box of the sprite with the voteSprite script, through the inspector.

When I set a break point in that Start() method at “guiTimer = GetComponent();” guiTimer gets nothing back. It is null, so I’m getting null reference error.

Can someone help me see what I’m doing wrong here?

Note: In this example, I have a private bool encapsulated by a public property, but I’ve tried it directly by setting “gameStart” to be a public field as well, to no avail.

what you are doing is trying to get GUITimer from the same object where voteSprite is, IF you want to get the GUITimer component from the empty game object you have, then A GameObject.Find(“yourEmptyObject”).GetComponent(), or B in your public guiTimer object in your votesprite class, go to inspector and manually select the empty object who has the GUITimer, then to access your public property GameStart you would need to just use guiTimer.GameStart