x


what dose it mean " @script " ???

Hi... I was working on the FPS example .

I found this code

@script RequireComponent (Rigidbody)

I remove it, but nothing change

and anther code

BroadcastMessage ("Detonate");

so what that codes do ..

thanks.

more ▼

asked Apr 01 '11 at 03:30 PM

fadi gravatar image

fadi
52 7 8 13

You should ask a two questions if you are wondering about something else, not edit your first question. In any case, here's something I think you might find useful: http://unity3d.com/support/documentation/ScriptReference/index.html You can search anything in there if you have a question.

Apr 01 '11 at 03:49 PM e.bonneville
(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

It requires a Rigidbody on the gameObject the script is attached to. When dragging this script onto a gameObject it will automatically add a Rigidbody. If you are trying to remove the rigidbody, it will deny the operation claiming rigidbody being a dependency for your script.

more ▼

answered Apr 01 '11 at 03:43 PM

Statement gravatar image

Statement ♦♦
20.1k 35 70 175

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

It means that that particular script depends on the object that it is applied to having a Rigidbody. It will not let you use it unless there is a Rigidbody on the object. The code is not essential though, it's just there for ease of use when you give a script to someone else etc.

more ▼

answered Apr 01 '11 at 03:43 PM

Xedfire 1 gravatar image

Xedfire 1
158 13 14 23

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

The first thing is just as the others said dont let you remove the component and the BroadcastMessage("Detonate") is used to activate a the method Detonate on the script that it belongs to this is commonly used to activate methods on a gameobject or group of gameobjects i use it like this

GameObject.Find("myObject").BroadcastMessage("MethodName",ParametersIfNeeded);

also can be sent to the father of "myobject" and it will share it to every son of his, or to avoid spreading the message is used SendMessage instead of BroadcastMessage

Hope this helps

more ▼

answered Apr 01 '11 at 04:04 PM

poncho gravatar image

poncho
932 2 3 14

(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:

x3324
x1786

asked: Apr 01 '11 at 03:30 PM

Seen: 821 times

Last Updated: Apr 01 '11 at 03:46 PM