Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

position is not a member of Object and GetChild()

$
0
0
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; } }

Viewing all articles
Browse latest Browse all 1875

Trending Articles