x


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'.

more ▼

asked Jun 09 '11 at 05:11 PM

smasgames gravatar image

smasgames
34 25 29 32

what are you trying to do? you cant enable/disable objects as far as im aware?

Jun 09 '11 at 05:19 PM CarlLawl
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Jun 10 '11 at 06:42 PM

terdos gravatar image

terdos
136 1 1 4

(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Jun 09 '11 at 05:20 PM

Jessy gravatar image

Jessy
15.7k 72 95 198

(4,13): BCE0005: Unknown identifier: 'hit'.

Jun 09 '11 at 05:23 PM smasgames

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 SOME context. There's nothing called hit, and hit.object wouldn't mean anything if there were.

Jun 09 '11 at 05:51 PM Jessy

y put fake script on here

Jun 09 '11 at 10:45 PM smasgames

o.O you put it on here, he didn't.

Jun 09 '11 at 10:59 PM Joshua

lol "why put fake script on here.." omg

Jun 10 '11 at 06:51 PM Anxowtf
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x199
x114
x19

asked: Jun 09 '11 at 05:11 PM

Seen: 818 times

Last Updated: Jun 10 '11 at 09:21 PM