RPC send/receive logging as an additional verbose logging level for developer debugging
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- csharp, unity
- Domaine
- networking
Piste de recherche
Commencez par examiner RpcMessage.cs Deserialize et NetworkBehaviour.cs __beginSendServerRpc ainsi que __beginSendClientRpc, avec le comportement existant de LogLevel et NetworkLog. Déterminez si les messages d’envoi/réception RPC doivent utiliser LogLevel.Developer ou nécessitent un nouveau niveau détaillé, puis vérifiez que les deux directions journalisent le nom du RPC sans modifier le comportement du profiler ou des métriques.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
It's excellent that RPCs appear in the Profiler. However, sometimes it's still nice to have logging of your RPCs that are being sent or received. You could include this in LogLevel.Developer or have a new LogLevel.Verbose
In RpcMessage.cs I would modify Deserialize:
public static unsafe bool Deserialize(ref FastBufferReader reader, ref NetworkContext context, ref RpcMetadata metadata, ref FastBufferReader payload)
{
ByteUnpacker.ReadValueBitPacked(reader, out metadata.NetworkObjectId);
ByteUnpacker.ReadValueBitPacked(reader, out metadata.NetworkBehaviourId);
ByteUnpacker.ReadValueBitPacked(reader, out metadata.NetworkRpcMethodId);
var networkManager = (NetworkManager)context.SystemOwner;
if (!networkManager.SpawnManager.SpawnedObjects.ContainsKey(metadata.NetworkObjectId))
{
networkManager.DeferredMessageManager.DeferMessage(IDeferredNetworkMessageManager.TriggerType.OnSpawn, metadata.NetworkObjectId, reader, ref context);
return false;
}
var networkObject = networkManager.SpawnManager.SpawnedObjects[metadata.NetworkObjectId];
var networkBehaviour = networkManager.SpawnManager.SpawnedObjects[metadata.NetworkObjectId].GetNetworkBehaviourAtOrderIndex(metadata.NetworkBehaviourId);
if (networkBehaviour == null)
{
return false;
}
if (!NetworkManager.__rpc_func_table.ContainsKey(metadata.NetworkRpcMethodId))
{
return false;
}
payload = new FastBufferReader(reader.GetUnsafePtrAtCurrentPosition(), Allocator.None, reader.Length - reader.Position);
#if DEVELOPMENT_BUILD || UNITY_EDITOR
if (NetworkManager.__rpc_name_table.TryGetValue(metadata.NetworkRpcMethodId, out var rpcMethodName))
{
if (NetworkLog.CurrentLogLevel == LogLevel.Developer) NetworkLog.LogInfo("RPC Received: " + rpcMethodName);
networkManager.NetworkMetrics.TrackRpcReceived(
context.SenderId,
networkObject,
rpcMethodName,
networkBehaviour.__getTypeName(),
reader.Length);
}
#endif
return true;
}
And in NetworkBehaviour.cs I would modify __beginSendServerRpc and __beginSendClientRpc:
#pragma warning disable IDE1006 // disable naming rule violation check
// RuntimeAccessModifiersILPP will make this `protected`
internal FastBufferWriter __beginSendServerRpc(uint rpcMethodId, ServerRpcParams serverRpcParams, RpcDelivery rpcDelivery)
#pragma warning restore IDE1006 // restore naming rule violation check
{
#if DEVELOPMENT_BUILD || UNITY_EDITOR
if (NetworkManager.__rpc_name_table.TryGetValue(rpcMethodId, out var rpcMethodName))
{
if (NetworkLog.CurrentLogLevel == LogLevel.Developer) NetworkLog.LogInfo("RPC Sent " + rpcMethodName);
}
#endif
return new FastBufferWriter(k_RpcMessageDefaultSize, Allocator.Temp, k_RpcMessageMaximumSize);
}
#pragma warning disable IDE1006 // disable naming rule violation check
// RuntimeAccessModifiersILPP will make this `protected`
internal FastBufferWriter __beginSendClientRpc(uint rpcMethodId, ClientRpcParams clientRpcParams, RpcDelivery rpcDelivery)
#pragma warning restore IDE1006 // restore naming rule violation check
{
#if DEVELOPMENT_BUILD || UNITY_EDITOR
if (NetworkManager.__rpc_name_table.TryGetValue(rpcMethodId, out var rpcMethodName))
{
if (NetworkLog.CurrentLogLevel == LogLevel.Developer) NetworkLog.LogInfo("RPC Sent " + rpcMethodName);
}
#endif
return new FastBufferWriter(k_RpcMessageDefaultSize, Allocator.Temp, k_RpcMessageMaximumSize);
}
- Langage dominant
- C#
- Étoiles
- 2.3k
- Forks
- 461
- Merge moyen
- 3 j 16 h
- PR mergées (30 j)
- 20
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de Unity-Technologies/com.unity.netcode.gameobjects
-
stat:import type:bug
Difficulté 4/5 3-5 jours Accessibilité débutants 68/100
-
stat:reply-needed type:support
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
Unity-Technologies/com.unity.netcode.gameobjects#4095 · 10 commentaires ·
-
stat:awaiting-triage stat:Investigating type:bug
Unity-Technologies/com.unity.netcode.gameobjects#3912 · 5 commentaires · 1 personne assignée ·
-
Tracking type:feature-2.x
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
Unity-Technologies/com.unity.netcode.gameobjects#3870 · 5 commentaires ·
-
Please error, or at least warn, when a managed type is included in INetworkSerializeByMemcpy OuverteTracking type:feature
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
Unity-Technologies/com.unity.netcode.gameobjects#3830 · 7 commentaires ·
Toutes les issues de Unity-Technologies/com.unity.netcode.gameobjects
Issues similaires
-
bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
azurenoops/spin_agent#975 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulté 2/5 1-3 heures Accessibilité débutants 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
SubtitleEdit/subtitleedit#15108 · 1 commentaire ·