|
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.
(comments are locked)
|
|
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.
(comments are locked)
|
|
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.
(comments are locked)
|
|
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
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
(comments are locked)
|

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.