title: Unity3D: Smooth Interaction When Loading Asset Via Network?
body: <p>I'm making a networked computer game using Unity3D version 3.x on Mac. I have a game client and a game server. Whenever data arrives at the client from the server, the client would freeze for a little bit (~0.5 seconds), render the new data, and then continue. Is there any way I can optimize my game so that incoming data does not affect user's interaction with the game client?</p>
  
  <p>Here's what I'm doing now:</p>
  
  <ol>
  <li>I created a new thread to pull data from the server.</li>
  <li>When the data arrives I put it in a buffer which is protected by a mutual exclusion lock.</li>
  <li>In the Unity thread, on every frame, I check if the buffer is empty. If it is not empty, I wait on the mutual exclusion lock for permission to process the data. Once I got the permission, I parse the data and render it.</li>
  </ol>
  
  <p>I'm doing this because Unity does not allow me to create new <code>GameObject</code>s in the network thread that I created. But I wonder if there's anything I can do to optimize user experience.</p>