You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

36 lines
746 B

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;
}
}
}