Class KCCPlatform
Predicted moving platform that uses FishNet Prediction V2 for deterministic movement. Players standing on this platform receive platform velocity through KCCPlayer.
public class KCCPlatform : TickNetworkBehaviour, ISceneObject
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourNetworkBehaviourTickNetworkBehaviourKCCPlatform
- Implements
- Inherited Members
-
TickNetworkBehaviour.SetTickCallbacks(TickNetworkBehaviour.TickCallback)TickNetworkBehaviour.TimeManager_OnPreTick()TickNetworkBehaviour.TimeManager_OnPostTick()TickNetworkBehaviour.TimeManager_OnUpdate()TickNetworkBehaviour.TimeManager_OnLateUpdate()NetworkBehaviour.IsSpawnedNetworkBehaviour.ComponentIndexNetworkBehaviour.NetworkObjectNetworkBehaviour.MAXIMUM_NETWORKBEHAVIOURSNetworkBehaviour.UNSET_NETWORKBEHAVIOUR_IDNetworkBehaviour.ToString()NetworkBehaviour.Reset()NetworkBehaviour.OnValidate()NetworkBehaviour.IsBehaviourReconcilingNetworkBehaviour.ClearReplicateCache()NetworkBehaviour.Reconcile_Reader<T>(PooledReader, ref T)NetworkBehaviour.OnStartServerCalledNetworkBehaviour.OnStartClientCalledNetworkBehaviour.OnStopNetwork()NetworkBehaviour.OnStartServer()NetworkBehaviour.OnStopServer()NetworkBehaviour.OnOwnershipServer(NetworkConnection)NetworkBehaviour.OnSpawnServer(NetworkConnection)NetworkBehaviour.OnDespawnServer(NetworkConnection)NetworkBehaviour.OnStartClient()NetworkBehaviour.OnStopClient()NetworkBehaviour.OnOwnershipClient(NetworkConnection)NetworkBehaviour.ClearBuffedRpcs()NetworkBehaviour.ExcludeOwnerFromUnbufferedObserversRpcsNetworkBehaviour.IsClientOnlyNetworkBehaviour.IsServerOnlyNetworkBehaviour.IsHostNetworkBehaviour.IsClientNetworkBehaviour.IsServerNetworkBehaviour.IsDeinitializingNetworkBehaviour.NetworkManagerNetworkBehaviour.ServerManagerNetworkBehaviour.ClientManagerNetworkBehaviour.ObserverManagerNetworkBehaviour.TransportManagerNetworkBehaviour.TimeManagerNetworkBehaviour.SceneManagerNetworkBehaviour.PredictionManagerNetworkBehaviour.RollbackManagerNetworkBehaviour.NetworkObserverNetworkBehaviour.IsClientInitializedNetworkBehaviour.IsClientStartedNetworkBehaviour.IsClientOnlyInitializedNetworkBehaviour.IsClientOnlyStartedNetworkBehaviour.IsServerInitializedNetworkBehaviour.IsServerStartedNetworkBehaviour.IsServerOnlyInitializedNetworkBehaviour.IsServerOnlyStartedNetworkBehaviour.IsHostInitializedNetworkBehaviour.IsHostStartedNetworkBehaviour.IsOfflineNetworkBehaviour.IsNetworkedNetworkBehaviour.GetIsNetworked()NetworkBehaviour.IsManagerReconcilingNetworkBehaviour.ObserversNetworkBehaviour.IsOwnerNetworkBehaviour.IsControllerNetworkBehaviour.HasAuthorityNetworkBehaviour.OwnerNetworkBehaviour.OwnerIdNetworkBehaviour.ObjectIdNetworkBehaviour.LocalConnectionNetworkBehaviour.OwnerMatches(NetworkConnection)NetworkBehaviour.Despawn(GameObject, DespawnType?)NetworkBehaviour.Despawn(NetworkObject, DespawnType?)NetworkBehaviour.Despawn(DespawnType?)NetworkBehaviour.Spawn(GameObject, NetworkConnection, Scene)NetworkBehaviour.Spawn(NetworkObject, NetworkConnection, Scene)NetworkBehaviour.RemoveOwnership()NetworkBehaviour.GiveOwnership(NetworkConnection)NetworkBehaviour.GetInstance<T>()NetworkBehaviour.TryRegisterInstance<T>(T)NetworkBehaviour.UnregisterInstance<T>()NetworkBehaviour.CanLog(LoggingType)MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.nameObject.hideFlags
Properties
GameObject
The Unity GameObject associated with this scene object.
public GameObject GameObject { get; }
Property Value
- GameObject
ID
Unique identifier for the scene object.
public long ID { get; set; }
Property Value
LastCompletedTickVelocity
Velocity of the platform during its most recently completed Step(float), in world
units per second. Players riding the platform read this value so the inherited platform
velocity is independent of whether the player's NetworkBehaviour ticks before or after
this platform within the same network tick (FishNet does not guarantee a deterministic
OnTick order across separate NetworkObjects). Lag is at most one tick (acceptable for
moving-platform inheritance) but the value is consistent between server and client
because both compute it from the same deterministic Step(float) — the server from
inside its [Replicate], a client directly from its tick.
public Vector3 LastCompletedTickVelocity { get; }
Property Value
- Vector3
Methods
CreateReconcile()
Override this method to create your reconcile data, and call your reconcile method.
public override void CreateReconcile()
OnStartNetwork()
Called when the network has initialized this object. May be called for server or client but will only be called once. When as host or server this method will run before OnStartServer. When as client only the method will run before OnStartClient.
public override void OnStartNetwork()
ReadPayload(NetworkConnection, Reader)
Called before network start callbacks, but after the object is initialized with network values. This may be used to read information from predicted spawning, or simply have values set before initialization without depending on SyncTypes.
public override void ReadPayload(NetworkConnection connection, Reader reader)
Parameters
connectionNetworkConnectionConnection sending the payload. When coming from the server connection.IsValid will return false.
readerReader
Remarks
Position and goal index are the platform's whole simulation state, and they are carried
here rather than by a reconcile because state forwarding is off on every object in this
project. With forwarding off a scene object has no owner to send a reconcile to
(Server_SendReconcileRpc returns immediately when !Owner.IsValid), so a
client that arrives mid-cycle would otherwise start the platform from its authored
position and run a full lap out of phase with the server, for the lifetime of the scene.
Per-tick movement needs no wire at all: Step(float) is autonomous and deterministic
— MoveTowards by a fixed TimeManager.TickDelta step — and it snaps exactly
onto each waypoint on arrival, so float drift is bounded within one leg and reset at every
corner. Both peers run it: the server from its [Replicate], a client directly from
TimeManager_OnTick, because FishNet will not invoke an ownerless, non-forwarded
replicate body on a client (which is why the platform stood still on every client until
the 2026-08-28 audit). Fourteen bytes once per observer, instead of a reconcile every tick
to every observer.
goals is built in Awake from the authored scene position, which is identical
on every peer, and Awake runs before this — so assigning the live position here
cannot disturb the waypoints it was derived from.
ResetState(bool)
Resets this NetworkBehaviour so that it may be added to an object pool.
public override void ResetState(bool asServer)
Parameters
asServerbool
TimeManager_OnTick()
protected override void TimeManager_OnTick()
Remarks
The server drives the platform through the predicted PerformReplicate(ReplicateData, ReplicateState, Channel).
A client cannot: with state forwarding off and no owner, FishNet's
Replicate_NonAuthoritative returns before it invokes the replicate body, no
reconcile is ever sent (see ReadPayload(NetworkConnection, Reader)), and this object carries no
NetworkTransform — so left to the replicate the platform never moved on any client
while it moved on the server, and riders diverged every tick. The client runs the
same deterministic step directly, from the state the spawn payload handed it.
TryGetVelocityForTick(uint, out Vector3)
The velocity this platform produced on a specific tick.
public bool TryGetVelocityForTick(uint tick, out Vector3 velocity)
Parameters
tickuintThe tick to look up.
velocityVector3The velocity produced on that tick, when still held.
Returns
- bool
True when the tick is still in the ring.
Remarks
A rider replaying k ticks after a reconcile needs the velocity of each replayed tick, not the platform's present one. The platform itself never replays — it has no owner and no reconcile reaches a client — so without this every replayed tick inherited one frozen value and the rider's replayed path bent at each direction reversal.
WritePayload(NetworkConnection, Writer)
Called when writing a spawn. This may be used to deliver information for predicted spawning, or simply have values set before initialization without depending on SyncTypes.
public override void WritePayload(NetworkConnection connection, Writer writer)
Parameters
connectionNetworkConnectionConnection receiving the payload. When sending to the server connection.IsValid will return false.
writerWriter