- Home /
 
sript gets error
this is the script:
 object : Transform;
 
 function OnTriggerEnter (other : Collider) {
      if(hit.object) { object.enabled = false; 
      }
 }
 
               script gets this error:
(1,1): BCE0044: expecting EOF, found 'object'.
what are you trying to do? you cant enable/disable objects as far as im aware?
Answer by terdos · Jun 10, 2011 at 06:42 PM
most likely what you are looking for is something like this:
 object: Transform;
 function OnTriggerEnter(other : Collider) {
  if (other.transform == object) {
   other.gameObject.SetActiveRecursively(false);
  }
 }
 
               this will disable/deactivate whatever object is when it is triggered.
Answer by Jessy · Jun 09, 2011 at 05:20 PM
You need to use the keyword var at the beginning.
You're also going to have trouble with
 if(hit.object)
 
               That doesn't mean anything.
Like I told you would happen. You'll have to make at effort at writing something that uses defined words. Just because it's syntax-highlighted doesn't mean it does anything. That just means it does something in SO$$anonymous$$E context. There's nothing called hit, and hit.object wouldn't mean anything if there were.
Your answer
 
             Follow this Question
Related Questions
EOF error message 2 Answers
BCE0044: expecting }, found 'class' alond with BCE0044: expecting EOF, found 'Card' 1 Answer
An EOF Problem :( 1 Answer
FPS Script Error OnCollisonEnter 1 Answer
error help 2 Answers