Example #1
0
    /// <summary>
    /// Broadcast the specified message to the entire UI.
    /// </summary>

    static public void Broadcast(string funcName)
    {
        for (int i = 0, imax = mRoots.Count; i < imax; ++i)
        {
            NGUIRoot root = mRoots[i];
            if (root != null)
            {
                root.BroadcastMessage(funcName, SendMessageOptions.DontRequireReceiver);
            }
        }
    }
Example #2
0
    /// <summary>
    /// Broadcast the specified message to the entire UI.
    /// </summary>

    static public void Broadcast(string funcName, object param)
    {
        if (param == null)
        {
            // More on this: http://answers.unity3d.com/questions/55194/suggested-workaround-for-sendmessage-bug.html
            Debug.LogError("SendMessage is bugged when you try to pass 'null' in the parameter field. It behaves as if no parameter was specified.");
        }
        else
        {
            for (int i = 0, imax = mRoots.Count; i < imax; ++i)
            {
                NGUIRoot root = mRoots[i];
                if (root != null)
                {
                    root.BroadcastMessage(funcName, param, SendMessageOptions.DontRequireReceiver);
                }
            }
        }
    }