RPC send/receive logging as an additional verbose logging level for developer debugging
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- csharp, unity
- Área
- networking
Línea de trabajo
Comienza revisando RpcMessage.cs Deserialize y NetworkBehaviour.cs __beginSendServerRpc y __beginSendClientRpc, junto con el comportamiento existente de LogLevel y NetworkLog. Decide si los mensajes de envío/recepción de RPC pertenecen a LogLevel.Developer o requieren un nuevo nivel detallado, y verifica después que ambas direcciones registren el nombre del RPC sin cambiar el comportamiento del profiler ni de las métricas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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);
}
- Lenguaje dominante
- C#
- Estrellas
- 2.3k
- Forks
- 461
- Merge medio
- 3 d 16 h
- PR fusionados (30 d)
- 20
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Unity-Technologies/com.unity.netcode.gameobjects
-
stat:import type:bug
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
-
stat:reply-needed type:support
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
Unity-Technologies/com.unity.netcode.gameobjects#4095 · 10 comentarios ·
-
stat:awaiting-triage stat:Investigating type:bug
Unity-Technologies/com.unity.netcode.gameobjects#3912 · 5 comentarios · 1 asignado ·
-
Tracking type:feature-2.x
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Unity-Technologies/com.unity.netcode.gameobjects#3870 · 5 comentarios ·
-
Please error, or at least warn, when a managed type is included in INetworkSerializeByMemcpy AbiertoTracking type:feature
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Unity-Technologies/com.unity.netcode.gameobjects#3830 · 7 comentarios ·
Todos los issues de Unity-Technologies/com.unity.netcode.gameobjects
Issues similares
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
azurenoops/spin_agent#975 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
SubtitleEdit/subtitleedit#15108 · 1 comentario ·