Only serialize variable when a bool equals true

Options
I have a quaternion that is constantly changing and needs to be serialized. However, I only need to serialize it while a bool equals true (otherwise it will just waste bandwidth). This is easy to write to the steam, but how can you check if a variable exists within the stream while reading it? There are multiple quaternions within the stream, sometimes this one will be included and other times it wont.

Best Answer

Answers