SyncObject.cs 1.0 KB

12345678910111213141516171819202122232425262728
  1. namespace Mirror
  2. {
  3. /// <summary>SyncObjects sync state between server and client. E.g. SyncLists.</summary>
  4. public interface SyncObject
  5. {
  6. /// <summary>True if there are changes since the last flush</summary>
  7. bool IsDirty { get; }
  8. /// <summary>Discard all the queued changes</summary>
  9. // Consider the object fully synchronized with clients
  10. void Flush();
  11. /// <summary>Write a full copy of the object</summary>
  12. void OnSerializeAll(NetworkWriter writer);
  13. /// <summary>Write the changes made to the object since last sync</summary>
  14. void OnSerializeDelta(NetworkWriter writer);
  15. /// <summary>Reads a full copy of the object</summary>
  16. void OnDeserializeAll(NetworkReader reader);
  17. /// <summary>Reads the changes made to the object since last sync</summary>
  18. void OnDeserializeDelta(NetworkReader reader);
  19. /// <summary>Resets the SyncObject so that it can be re-used</summary>
  20. void Reset();
  21. }
  22. }