title: Understanding bitwise XOR (^) with boolean variables
body: <p>I'm from a game programming background and I've just come across a bitwise XOR ^. I've seen examples of how it works with integers, but I'm a bit confused about the result with boolean values. I know a bool is either 0 or 1, but after testing I haven't been able to replicate the ^ result with simple operators. Could someone please explain to me what the following code snippet (specifically the ^) is doing? Many thanks.</p>
  
  <pre><code>bool body1awake = rigidbody1.isAwake;
  bool body2awake = rigidbody2.isAwake;
  if (body1awake ^ body2awake)
  {
      if (body1awake) rigidbody2.SetAwake();
      else rigidbody1.SetAwake();
  }
  </code></pre>