- Home /
enable something in function start
here is the script
var camera1 : Camera;
var camera2 : Camera;
function Start(){ fpp.enabled = false; tpp.enabled = true; } function Update() { var fpp= gameObject.GetComponent(fpp); var tpp= gameObject.GetComponent(tpp);
if(Input.GetButtonDown("[")) {
 
                    camera1.enabled = true;
     camera2.enabled = false;
     fpp.enabled = false;
     tpp.enabled = true;
     mouselook.look = false;
 } else if(Input.GetButtonDown("]")) {
      camera1.enabled = false;
     camera2.enabled = true;
     tpp.enabled = false;
     fpp.enabled = true;
     mouselook.look = true;
 } 
}
i need the fpp.enabled = false; and the tpp.enabled = true; to execute in the function Start() but i get an error anyone know how to fix it
this is the error BCE0020: An instance of type 'UnityEngine.Behaviour' is required to access non static member 'enabled'.
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Mike Ledwards · Jan 13, 2011 at 06:52 AM
i think its because your variable is in the Update function the Start won't recognise it unless its in there too.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                