x


Scoring Point Error?

When i try to run it to something to core a point this error comes up:MissingFieldException: Field'System.Object.tag' not found.

My Script:(attached to 'point')

var score = 0;

print("Score: "+score);

function OnTriggerEnter( hit : Collider ) {

if(Object.tag == "player")
{
    score += 5;
Destroy(gameObject);  

}

}

And I checked, my player is tagged with the all lower case word, "player"!

more ▼

asked Aug 13 '10 at 12:43 PM

john 2 gravatar image

john 2
75 29 35 46

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

1 answer: sort voted first

"Object" is a keyword for an existing class. If you are trying to refer to the tag of the collider that caused the trigger, use hit.tag.

more ▼

answered Aug 13 '10 at 01:05 PM

Wolfram gravatar image

Wolfram
9.1k 8 20 53

thanks it worked!

Aug 13 '10 at 01:25 PM john 2
(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:

x5269
x2166
x133

asked: Aug 13 '10 at 12:43 PM

Seen: 409 times

Last Updated: Aug 13 '10 at 12:43 PM