Llama al método denominado methodName de todos los MonoBehaviour en este game objecto en cualquiera de sus hijos.
El método receptor puede optar por ignorar a parameter colocando cero parámetros.
Si las opciones están colocadas en SendMessageOptions.RequireReceiver, un error será impreso si el mensaje no es recogido por ningún componente.
/// Calls the function ApplyDamage with a value of 5
gameObject.BroadcastMessage ("ApplyDamage", 5.0);
// Every script attached to the game object and all its children
// that has a ApplyDamage function will be called.
function ApplyDamage (damage : float) {
print (damage);
}
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void ApplyDamage(float damage) { print(damage); } void Example() { gameObject.BroadcastMessage("ApplyDamage", 5.0F); } }