public void OnReplayDeserialize(ReplayState state) { // Read the object identity objectIdentity = state.ReadIdentity(); timestamp = state.ReadFloat(); // Read the flags flags = (ReplayInitialDataFlags)state.Read16(); // Read position if ((flags & ReplayInitialDataFlags.Position) != 0) { position = state.ReadVec3(); } // Read rotation if ((flags & ReplayInitialDataFlags.Rotation) != 0) { rotation = state.ReadQuat(); } // Read scale if ((flags & ReplayInitialDataFlags.Scale) != 0) { scale = state.ReadVec3(); } // Read parent identity if ((flags & ReplayInitialDataFlags.Parent) != 0) { parentIdentity = state.ReadIdentity(); } // Read the number of observed components int size = state.Read16(); // Allocate the array observedComponentIdentities = new ReplayIdentity[size]; // Read all ids for (int i = 0; i < size; i++) { // Read the identity observedComponentIdentities[i] = state.ReadIdentity(); } }