Add warning when not consuming all bytes of a logic component

This commit is contained in:
AeonLucid committed 2022-12-19 15:55:27 +01:00
1 parent 5a8927e4c9
commit 4e5edcee49
2 files changed
+13 -2

No files matched your search

@@ -78,7 +78,19 @@ internal abstract class InnerGameManager : InnerNetObject, IInnerGameManager
continue;
}
this._logicComponents[tag].Deserialize(innerReader, initialState);
var component = this._logicComponents[tag];
component.Deserialize(innerReader, initialState);
if (innerReader.Position < innerReader.Length)
{
_logger.LogWarning(
"Server did not consume all bytes from {0} component {1} ({2} < {3}).",
nameof(InnerGameManager),
component.GetType().FullName,
reader.Position,
reader.Length);
}
}
return ValueTask.CompletedTask;
@@ -17,6 +17,5 @@ internal abstract class GameLogicComponent
public virtual void Deserialize(IMessageReader reader, bool initialState)
{
throw new NotImplementedException();
}
}