Question by 
               Arvis1 · Jul 21, 2016 at 11:01 PM · 
                javascripttransform.position  
              
 
              position is not a member of Object and GetChild()
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;
     }
 }
 
              
               Comment
              
 
               
              Answer by Arkaid · Jul 22, 2016 at 12:03 AM
I mainly code in C#, so I can't really say, but I'm going to shoot and say switchButton never gets initialized. This:
  switchButton = this.gameObject.transform.GetChild(0);
 
               should be inside Start() or Awake()
Your answer