my variable wont change??

I made this script to basically change the ‘lookingAt’ variable when the player looks at an object, i have already tested this in another script and it worked before, but why wont it work in this one? all the public variables have been defined, and this script has been basically tweeked after copy and pasting it out of the working one, why wont it work now?

using UnityEngine;
using System.Collections;

public class RuneScript : MonoBehaviour {
	
	public int LookingAt = 0;
	
	RaycastHit Hit;
	
	public GameObject mesh;
	public GameObject topRune;
	public GameObject leftRune;
	public GameObject rightRune;
	
	public LayerMask topRunestone;
	public LayerMask leftRunestone;
	public LayerMask rightRunestone;
	
	public float Range;
	
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		
		Vector3 DirectionOfLine = mesh.transform.TransformDirection(Vector3.forward);
		
		Debug.DrawRay (mesh.transform.position, DirectionOfLine * Range, Color.blue);
		
		if (Physics.Raycast (mesh.transform.position, DirectionOfLine, Range, topRunestone.value)) { 
				
				LookingAt = 1;
		}
		
		if (Physics.Raycast (mesh.transform.position, DirectionOfLine, Range, leftRunestone.value)) { 
				
				LookingAt = 2;
		}
		
		if (Physics.Raycast (mesh.transform.position, DirectionOfLine, Range, rightRunestone.value)) { 
				
				LookingAt = 3;
		}
		
	
	}
	
	void OnGUI () {
		
		if (LookingAt == 0) {
			
			GUI.Label (new Rect ((Screen.width/2)-75,10,150,50), "Not loo");
			
		}
		
		if (LookingAt == 1) {
			
			GUI.Label (new Rect ((Screen.width/2)-75,10,150,50), "Click to activate Hagalaz");
			
		}
		
		if (LookingAt == 2) {
			
			GUI.Label (new Rect ((Screen.width/2)-75,10,150,50), "Click to activate Nauthiz");
			
		}
		
		if (LookingAt == 3) {
			
			GUI.Label (new Rect ((Screen.width/2)-75,10,150,50), "Click to activate Ansuz");
			
		}
		
	}
}

Have you identified exactly where the problem is? For instance, I would put
Debug.Log(“blah”);
inside each of your if(Physics…) statements. That way you can see if it is even getting inside of them. If the blahs display there, take them out and put them into your if(LookingAt == x) statements.

Unless you need to have several if statements, I would strongly advise putting them into if/else if structures. This shouldn’t technically make a difference with the problem you’re having, but from what it looks like right now you don’t need to have several separate if statements.

Finally, try changing your LookingAt calls to this.LookingAt. That may help but don’t be surprised if it does nothing.

And don’t forget that if all else fails it isn’t uncommon to just restart the code or recopy it from the working source to make sure you didn’t actually make things buggy.