Execution
Default execution
Following diagram shows the default execution order of Fusion callbacks used by KCC within a single Unity frame.
- (1) is executed only when new data from the server is received.
- (2) is executed when simulating
1-Nforward ticks. - (3) is executed if there is no enough delta time to simulate new tick.
- (4) is executed if there are more resimulation or forward ticks pending simulation.
- (5) is executed after all resimulation and forward ticks are simulated.
Following scenarios are possible:
- New data received from the server = [Y] resimulation ticks => [X] forward ticks => render update.
- No data received = [X] forward ticks => render update.
- No data received and no enough delta time = Only render update.
Following diagrams show a detailed overview of Fusion callbacks followed by execution of KCC internal logic.
⚠️ Some operations are valid only for input/state authority or proxy. For example proxy never writes to the network buffer.
Execution of Move subroutines is defined by Input Authority Behavior, State Authority Behavior and Proxy Behavior in KCC Settings section.
| Input Authority Behavior | Fixed Update | Render Update |
|---|---|---|
| Predict Fixed | Interpolate Render | Move (Predicted) | Move (Interpolated) |
| Predict Fixed | Predict Render | Move (Predicted) | Move (Predicted) |
| State Authority Behavior | Fixed Update | Render Update |
|---|---|---|
| Predict Fixed | Interpolate Render | Move (Predicted) | Move (Interpolated) |
| Predict Fixed | Predict Render | Move (Predicted) | Move (Predicted) |
| Proxy Behavior | Fixed Update | Render Update |
|---|---|---|
| Skip Fixed | Interpolate Render | Nothing | Server snapshots interpolation |
| Interpolate Fixed | Interpolate Render | Server snapshots interpolation | Server snapshots interpolation |
| Predict Fixed | Interpolate Render | Move (Predicted) | Move (Interpolated) |
| Predict Fixed | Predict Render | Move (Predicted) | Move (Predicted) |
Manual execution
By default KCC fixed/render updates execute before HitboxManager to support lag compensation.
For precise execution order control, manual execution can be enabled:
C#
public class Player : NetworkBehaviour
{
public KCC KCC;
public override void Spawned()
{
KCC.SetManualUpdate(true);
}
public override void FixedUpdateNetwork()
{
KCC.ManualFixedUpdate();
}
public override void Render()
{
KCC.ManualRenderUpdate();
}
}
Back to top