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.

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.

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.

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