Closed adamscoble closed 2 years ago
Also seeing this 1.5.3 pro - network animator, predition, no user syncvars
Also seeing this 1.5.3 pro - network animator, predition, no user syncvars
Not sure what you mean you're seeing it in network animator. That output is there to help you track down the problem, it doesn't necessarily mean that the latest packets are the problem.
Make a build, with the build running as host, then connect the Editor as a client. You should see the error intermittently in the console.
I tried reproducing on a smaller sample and was not able to. It looks like the problem might be a broadcast packet though? Does it reliably show the previous packetId as broadcast?
I'll try with your code in the next few days. Here's how I tested on mine, let me know if you see any obvious differences. I dropped it on a player prefab. The IL code looked correct as well.
using FishNet.Serializing;
public class MTT
{
public int Value;
}
public static class CustomRWThingy
{
public static void WriteMTT(this Writer w, MTT v)
{
w.WriteInt32(v.Value);
}
public static MTT ReadMTT(this Reader r)
{
return new MTT()
{ Value = r.ReadInt32(), };
}
}
using FishNet.Object.Prediction;
using FishNet.Object.Synchronizing;
using UnityEngine;
public class PredictionIL : NetworkBehaviour
{
private struct MD
{
public int Frame;
}
[SyncVar]
private MTT _sv;
private void Update()
{
//being lazy with code.
if (base.NetworkManager == null)
return;
//Dont ever use this for prediction.
if (!base.TimeManager.FrameTicked)
return;
if (base.IsOwner)
{
Reconcile(default, false);
Replicate(new MD() { Frame = Time.frameCount }, false);
}
if (base.IsServer)
{
Replicate(default, true);
Reconcile(new MD() { Frame = Time.frameCount }, true);
}
}
[Replicate]
private void Replicate(MD data, bool asServer, bool replaying = false)
{
_sv = new MTT() { Value = Time.frameCount };
}
[Reconcile]
private void Reconcile(MD md, bool asServer)
{
_sv = new MTT() { Value = Time.frameCount };
}
}
Does it reliably show the previous packetId as broadcast?
Sorry just to clarify, what does this mean? I'm sure I've had it as something like
Unset
Unset
SyncVar
before, though I'm failing to achieve it now.
Could be something else entirely but that unfortunately isn't enough to get me in the right direction. Please update to 156 and see if problem persist.
Could be something else entirely but that unfortunately isn't enough to get me in the right direction. Please update to 156 and see if problem persist.
Did you try out the reproduction script I included in your CharacterControllerPrediction scene? It reproduces the error every time.
Disappeared for me on upgrade to 1.5.6. don't keep it open on my account.
Thanks for letting me know.
The custom struct I've included to reproduce this works perfectly fine as a SyncVar outside of prediction code. However when set from within a [Replicate] function, I get a repeating error on the client only:
To reproduce, add this as
Test.cs
to the same directory asCharacterControllerPrediction.cs
, and add the Test component to the CharacterControllerPrediction prefab:On line 105 of
CharacterControllerPrediction.cs
after the call to_characterController.Move()
, call:Make a build, with the build running as host, then connect the Editor as a client. You should see the error intermittently in the console.