C# script wont access other C# script's variable via GetComponent<> anymore...

It was all working fine and I did nothing wrong that would make this error… So I wan’t a Cube to access another script variable wich says : If the variable EditMode on Script A is true, then do something. But suddenly, for no reasons… My script won’t access the other Script :frowning:

I store the other scipt’s bool variable in a local bool variable wich I called edit… But I tried to access the variable directly using GetComponent().editMode… Both are’nt working!

In the editor, I can clearly see that my variable is changing, but the other script is ignoring it even if I told it to read it every single frame!

public class scr_constructionCube : MonoBehaviour {

    public GameObject controller;

    public bool used, edit;
    private Vector3 destLoc;
    public GameObject prop;

	void Start () 
    {
        destLoc = new Vector3(transform.position.x, transform.position.y - transform.localScale.y / 2, transform.position.z);

        if (controller == null)
        { controller = GameObject.FindWithTag("GameController"); }
        
        if (controller != null)
        {
            prop = controller.GetComponent<scr_gameMode>().theProp;
	        edit = controller.GetComponent<scr_gameMode>().editMode;
        }
        //ONLY RENDER WHEN MOUSE OVER
        gameObject.renderer.enabled = false;        
	}
	
	void Update () 
    {
        //I'M CHECKING IF THE BOOL CHANGE
        prop = controller.GetComponent<scr_gameMode>().theProp;
		edit = controller.GetComponent<scr_gameMode>().editMode;
	}

    void OnMouseOver()
    {
        //THERE IS THE PROBLEM! WON'T GET IN THIS STATEMENT
	    if (edit && !used)
        {
            gameObject.renderer.enabled = true;

            if (Input.GetMouseButtonUp(0))
            {
                if (prop != null)
                {
                    Instantiate(prop, destLoc, transform.rotation);
                    Debug.Log("No Way it's not working!");
                }
                else
                { Debug.Log("There is no Prop in GameMode.theProp!");}
            }
        }
    }
}

[36183-this+var+is+working.png|36183]
[36184-why+you+do+this+to+me!.png|36184]

PS: The “used” var remains false…
I’ve been working too hard to start it over… Please tell me I did a stupid error… :frowning: :frowning:

Hey taxvi! Thanks showing interest in helping me, I really appreciate! But I think found the problem! I created a prefab with my controller in my assets folder and I think my script looked for it instead of searching active object in the scene! So my bool stayed false!