This code is giving me 2 errors "BCE0019: 'position' is not a member of 'Object'. " at lines where I try to change position. Can anyone tell me what's wrong? Script is attached to an object whose child i need to reposition depending on the raycast result.
#pragma strict
public var switchButton;
switchButton = this.gameObject.transform.GetChild(0);
function Update () {
if(Physics.Raycast(Vector3(transform.position.x,transform.position.y-0.3,transform.position.z),Vector3.up,1)){
switchButton.position.y=0;
//Debug.Log(switchButton);
}
else{
switchButton.position.y=0.175;
}
}
↧