|
|
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Networking;
-
-
- namespace Multiplayer
- {
-
- public static class Utility
- {
-
- public static bool ReadMessage<T>(NetworkMessage msg, out T outMsg, bool logError = true) where T : MessageBase, new()
- {
- outMsg = new T();
- bool isValid = true;
-
- try
- {
- outMsg = msg.ReadMessage<T>();
- isValid = true;
- }
- catch (UnityException e)
- {
- isValid = false;
- msg.reader.SeekZero();
-
- #if UNITY_EDITOR
- Debug.LogError(e);
- #endif
- }
-
- return isValid;
- }
- }
- }
|