This code seems to cause NetCode to generate an empty serializer, despite deleting the folder and clicking “Build” through the code generation wizard.
public struct MoveClientToServerRpcCommand : IRpcCommand
{
public long X;
public long Y;
public long Z;
}
namespace Assembly_CSharp.Generated
{
[BurstCompile]
public struct MoveClientToServerRpcCommandSerializer : IComponentData, IRpcCommandSerializer<MoveClientToServerRpcCommand>
{
public void Serialize(ref DataStreamWriter writer, in RpcSerializerState state, in MoveClientToServerRpcCommand data)
{
}
public void Deserialize(ref DataStreamReader reader, in RpcDeserializerState state, ref MoveClientToServerRpcCommand data)
{
}
Receiving system
[UpdateInGroup(typeof(ServerSimulationSystemGroup))]
public class MoveRpcCommandServerSystem : ComponentSystem
{
protected override void OnUpdate()
{
Entities
.ForEach((Entity entity, ref MoveClientToServerRpcCommand cmd, ref ReceiveRpcCommandRequestComponent req) =>
{
PostUpdateCommands.DestroyEntity(entity);
var group = World.GetExistingSystem<GhostPredictionSystemGroup>();
var broadcast = PostUpdateCommands.CreateEntity();
Debug.Log($"[SERVER] Received {cmd.X}, {cmd.Y}, {cmd.Z}");
Debug.Log($"[SERVER] Received {new fp3( fp.FromRaw(cmd.X), fp.FromRaw(cmd.Y), fp.FromRaw(cmd.Z) )}");
PostUpdateCommands.AddComponent(broadcast, new MoveServerToClientRpcCommand
{
Tick = group.PredictingTick,
X = cmd.X,
Y = cmd.Y,
Z = cmd.Z
});
PostUpdateCommands.AddComponent(broadcast, new SendRpcCommandRequestComponent());
});
}
}