Closed SimEof closed 1 month ago
This seems to be partially working.
The callbacks are failing at the very beginning as you said. But the values are synchronizing and printing properly.
using FishNet.Object;
using FishNet.Object.Synchronizing;
using UnityEngine;
/// <summary>
/// Test by starting the server in one editor, then the client in another. Ensure that syncTimer value is synchronized.
///
/// Also reported that callback does not work when client subscribes in OnStartNetwork. Test in awake, and in OnStartNetwork.
/// </summary>
public class SyncTimer_Sync_Test : NetworkBehaviour
{
private void Awake()
{
_st.OnChange += StOnOnChange;
}
private readonly SyncTimer _st = new();
public override void OnStartServer()
{
_st.StartTimer(15f);
}
public override void OnStartNetwork()
{
Debug.Log($"Network Start. Remaining {_st.Remaining}.");
}
private void StOnOnChange(SyncTimerOperation op, float prev, float next, bool asServer)
{
Debug.Log($"Change callback received. Op {op}. Prev {prev}. Next {next}. AsServer {asServer}.");
}
private void Update()
{
_st.Update();
}
}
Setting as a bug to resolve callbacks.
Note: I subscribed in Awake for testing - disregard me doing so.
Won't make it into 4.4.6, probably next release.
I believe this is resolved in 4.4.8 (pending release soon). I fixed a different SyncTimer bug and am getting all the callbacks now on this test as well.
Important
If General, Description, and Replication are not completed the issue will be closed immediately.
General Unity version: 2022.3.40.f1 Fish-Networking version: 4.4.4 Pro
Description SyncTimer OnChange not called for clients.
Replication Steps to reproduce the behavior:
Expected behavior When a new client joins the host, subscribes to SyncTimer OnChange and SyncTimer initialy receives data from server - client receives an event with current state of the timer and timer is in sync with the server.