继承发送广播、消息

Myself.cs
---------

using UnityEngine;
using System.Collections;

public class Myself : MonoBehaviour {

    void Update () {

        if( Input.GetKey( KeyCode.A ) ) 
        {
            // 发送消息 to 父亲
            gameObject.SendMessageUpwards( "RecvMsgFromSon", "I Am Your Son." );
        }

        if( Input.GetKey( KeyCode.D ) ) 
        {
            // 发送消息 to 儿子
            gameObject.BroadcastMessage( "RecvMsgFromFather", "I Am Your Father." );
        }

        if( Input.GetKey( KeyCode.S ) ) 
        {
            // 发送消息 to 自己
            gameObject.SendMessage ( "ReceiveSendMessage", "I Am Myself." );
        }
    }

    void ReceiveSendMessage( string str )
    {
        Debug.Log ("Recv Msg From Myself: " + str);
    }
}
Father.cs
---------
using UnityEngine;
using System.Collections;

public class Father : MonoBehaviour {

    void RecvMsgFromSon( string str )
    {
        Debug.Log ("Father Recved From Son's Msg :" + str);
    }
}
Son.cs
-------
using UnityEngine;
using System.Collections;

public class Son : MonoBehaviour {

    void RecvMsgFromFather( string str )
    {
        Debug.Log( "Son Recved Msg From Father :" + str) ;
    }
}