title: C# OnTriggerEnter, Pick up an object. OnTriggerExit, drop the object
body: <p>I'm trying to get my sprite to pick up a cube when it encounters one, if it isn't already carrying one. If it is, drop the cube it is carrying.</p>
  
  <p>This is what I have right now.  </p>
  
  <pre><code>void OnTriggerEnter(Collider other)
  {      
      if (other.Tag == "cube")  
      {
          other.Transform.position = this.Transform.position;
      }
  }
  </code></pre>
  
  <p>I tried telling the cube to become a child of the sprite. Wasn't working. All this does is put the cube to the sprites position when the trigger is entered, but the cube stays in that position while the sprite wonders off. </p>