Example #1
0
        /// <summary>
        /// Invoke the specified function. It's unlikely that you will need to call this function yourself.
        /// </summary>

        static public void FindAndExecute(int channelID, uint objID, string funcName, params object[] parameters)
        {
            TNObject obj = TNObject.Find(channelID, objID);

            if (obj != null)
            {
                if (obj.Execute(funcName, parameters))
                {
                    return;
                }
#if UNITY_EDITOR
                Debug.LogError("[TNet] Unable to execute function '" + funcName + "'. Did you forget an [RFC] prefix, perhaps?\n" +
                               "GameObject: " + GetHierarchy(obj.gameObject), obj.gameObject);
#endif
            }
#if UNITY_EDITOR
            else if (TNManager.isJoiningChannel)
            {
                Debug.Log("[TNet] Trying to execute a function '" + funcName + "' on TNObject #" + objID +
                          " before it has been created.");
            }
            else
            {
                Debug.LogWarning("[TNet] Trying to execute a function '" + funcName + "' on TNObject #" + objID +
                                 " before it has been created.");
            }
#endif
        }
Example #2
0
        /// <summary>
        /// Invoke the specified function. It's unlikely that you will need to call this function yourself.
        /// </summary>

        static public void FindAndExecute(int channelID, uint objID, byte funcID, params object[] parameters)
        {
            TNObject obj = TNObject.Find(channelID, objID);

            if (obj != null)
            {
                if (obj.Execute(funcID, parameters))
                {
                    return;
                }
#if UNITY_EDITOR
                Debug.LogError("[TNet] Unable to execute function with ID of '" + funcID + "'. Make sure there is a script that can receive this call.\n" +
                               "GameObject: " + GetHierarchy(obj.gameObject), obj.gameObject);
#endif
            }
#if UNITY_EDITOR
            else if (TNManager.isJoiningChannel)
            {
                Debug.Log("[TNet] Trying to execute RFC #" + funcID + " on TNObject #" + objID + " before it has been created.");
            }
            else
            {
                Debug.LogWarning("[TNet] Trying to execute RFC #" + funcID + " on TNObject #" + objID + " before it has been created.");
            }
#endif
        }