Moved a couple of folders and wrote some code
This commit is contained in:
@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace FishNet.Managing.Debugging
|
||||
{
|
||||
/// <summary>
|
||||
/// A container for debugging.
|
||||
/// </summary>
|
||||
[DisallowMultipleComponent]
|
||||
[AddComponentMenu("FishNet/Manager/DebugManager")]
|
||||
public class DebugManager : MonoBehaviour
|
||||
{
|
||||
public bool ObserverRpcLinks = true;
|
||||
public bool TargetRpcLinks = true;
|
||||
public bool ReplicateRpcLinks = true;
|
||||
public bool ReconcileRpcLinks = true;
|
||||
public bool ServerRpcLinks = true;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6d0962ead4b02a34aae248fccce671ce
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: bf9191e2e07d29749bca3a1ae44e4bc8, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -0,0 +1,73 @@
|
||||
#if UNITY_EDITOR || DEVELOPMENT_BUILD
|
||||
using FishNet.Managing.Logging;
|
||||
using FishNet.Object;
|
||||
using FishNet.Serializing;
|
||||
using FishNet.Transporting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace FishNet.Managing.Debugging
|
||||
{
|
||||
|
||||
internal class ParseLogger
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains the last several non-split packets to arrive. This is used for debugging.
|
||||
/// </summary>
|
||||
private Queue<PacketId> _incomingPacketIds = new Queue<PacketId>();
|
||||
/// <summary>
|
||||
/// Maximum number of packets allowed to be queued.
|
||||
/// </summary>
|
||||
private const int PACKET_COUNT = 5;
|
||||
|
||||
/// <summary>
|
||||
/// Resets data.
|
||||
/// </summary>
|
||||
internal void Reset()
|
||||
{
|
||||
_incomingPacketIds.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a packet to data.
|
||||
/// </summary>
|
||||
/// <param name="pId"></param>
|
||||
internal void AddPacket(PacketId pId)
|
||||
{
|
||||
_incomingPacketIds.Enqueue(pId);
|
||||
if (_incomingPacketIds.Count > PACKET_COUNT)
|
||||
_incomingPacketIds.Dequeue();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prints current data.
|
||||
/// </summary>
|
||||
internal void Print(NetworkManager nm)
|
||||
{
|
||||
if (nm == null)
|
||||
nm = InstanceFinder.NetworkManager;
|
||||
|
||||
//Only log if a NM was found.
|
||||
if (nm != null)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (PacketId item in _incomingPacketIds)
|
||||
sb.Insert(0, $"{item.ToString()}{Environment.NewLine}");
|
||||
|
||||
NetworkObject lastNob = Reader.LastNetworkObject;
|
||||
string nobData = (lastNob == null) ? "Unset" : $"Id {lastNob.ObjectId} on gameObject {lastNob.name}";
|
||||
NetworkBehaviour lastNb = Reader.LastNetworkBehaviour;
|
||||
string nbData = (lastNb == null) ? "Unset" : lastNb.GetType().Name;
|
||||
|
||||
nm.LogError($"The last {_incomingPacketIds.Count} packets to arrive are: {Environment.NewLine}{sb.ToString()}");
|
||||
nm.LogError($"The last parsed NetworkObject is {nobData}, and NetworkBehaviour {nbData}.");
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afc241e869d97a44f8339510586dce73
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user