/// <summary> /// Called once per frame. /// </summary> void Update() { if (currentFrame >= syncInterval) { currentFrame = 0; if (!IsSetup && !SyncEnabled) { return; } // Updates object's position continuously, or, if the CanSync criteria is met. if (syncedObject.CanSync() || sendConstantSync) { SendObjectSync(ObjectSyncManager.SyncTypes.GenericSync, true, false); } // Periodically update the object's position if periodic sync is enabled. if (syncedObject.PeriodicSyncEnabled() && ObjectSyncManager.Instance.ShouldPeriodicSync(Owner, SyncEnabled)) { SendObjectSync(ObjectSyncManager.SyncTypes.PeriodicSync, true, false); } } else { currentFrame++; } }
/// <summary> /// Called once per frame. /// </summary> void Update() { if (isSetup) { if (SyncEnabled) { // Updates object's position continuously. // (Typically used when player is holding a pickupable, or driving a vehicle) if (sendConstantSync) { SendObjectSync(ObjectSyncManager.SyncTypes.GenericSync, true, false); } // Check if object should be synced. else if (syncedObject.CanSync()) { SendObjectSync(ObjectSyncManager.SyncTypes.GenericSync, true, false); } } // Periodically update the object's position if periodic sync is enabled. if (syncedObject.PeriodicSyncEnabled() && ObjectSyncManager.Instance.ShouldPeriodicSync(Owner, SyncEnabled)) { SendObjectSync(ObjectSyncManager.SyncTypes.PeriodicSync, true, false); } } }