I made a script for opening a gate but when i try to game attach game object to it , it was not going not even by using small dot besides it .
It only shows some fbx objects.
Please help
Here is the script
using UnityEngine.UI;
public class DoorCellOpen : MonoBehaviour {
public float TheDistance;
public GameObject ActionDisplay;
public GameObject ActionText;
public GameObject TheDoor;
public AudioSource CreakSound;
void Update () {
TheDistance = PlayerCasting.DistanceFromTarget;
}
void OnMouseOver () {
if (TheDistance <= 2) {
ActionDisplay.SetActive (true);
ActionText.SetActive (true);
}
if (Input.GetButtonDown("Action")) {
if (TheDistance <= 2) {
this.GetComponent<BoxCollider>().enabled = false;
ActionDisplay.SetActive(false);
ActionText.SetActive(false);
TheDoor.GetComponent<Animation> ().Play ("FirstDoorOpenAnim");
CreakSound.Play ();
}
}
}
void OnMouseExit() {
ActionDisplay.SetActive (false);
ActionText.SetActive (false);
}
}
There was no compile errors .