- Home /
Open door with key
Hello everyone , once again I need help . I found this script in: http://answers.unity3d.com/questions/59908/open-door-with-key.html I was very happy so far to test it , then I got frustrated because it did not work , you may have done something wrong , because every time I try to enter the playback mode , I get the famous message (All compille error have to be fixed Can Playmode before you enter ! ) appears on the console this error: ( Assets / Standard Assets / Scripts / Custom Script / KeyScript.js ( 8,18) : BCE0019 : ' gotKey ' is not a member of ' UnityEngine.Transform .' ) . what to do to fix this? note: I used the last two routings suggested by Block ( burgunfaust ) put a trigger in the other key. Thank you.
scripts:
Roteiro para a chave
 var doorKeyOpens: Transform;
 private var gotKey: Boolean = false;
 
 função OnControllerColliderHit (hit: ControllerColliderHit) {
 
 if (hit.gameObject.name == "chave") {
        print ("Você pegou a chave House");
     doorKeyOpens.gotKey = true;
     Destroy (hit.gameObject);    
     }  
 } 
 
 Roteiro porta
     
     var porta: Transforme;
     var gotKey: Boolean = false;
     var angleOpen: int;
     var angleClose: int;
     var speedOpen: int = 1000;
     
     função OnTriggerStay (outro: Collider) {
         if (door.transform.localEulerAngles.y <angleOpen) {
             door.transform.Rotate (Vector3.up * Time.deltaTime * speedOpen);
         }
     }
Answer by Berenger · Feb 06, 2012 at 03:23 PM
doorKeyOpens doesn't seem to be initialized, and Transform don't have a gotKey field anyway.
Thanks for the reply, but did not understand what you wanted to say. after this script has a problem, how to solve it?
Your answer
 
 
             Follow this Question
Related Questions
Opening a door with a key 2 Answers
Opening a door with a key 0 Answers
Using If functions to open door with a key. 1 Answer
How to make 2 doors with 2 diffrent keys 2 Answers
Opening an animated door with a keycard 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                