Error:
Assets/Scripts/ButtonPush.js(6,48): BCE0043: Unexpected token: &&.
Script:
var ButtonDown : AnimationClip;
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
function Update () {
if (Physics.Raycast (ray, hit, 100)) {
if ( hit.collider.gameObject.name == "Button") && (Input.GetMouseButtonDown(0)) {
animation.Play("ButtonDown");
audio.Play();
}
}
}
Question:
Why?
Perfect... But I am getting this error now: get_main can only be called from the main thread. Constructors and field initializers will be executed from the loading thread when loading a scene. Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function. I don't even have a start function.
– LightSourceI have no idea. Best this was a new question, post the whole script.
– DaveANever mind, I got the script to work.
– LightSource