Adapted for Unity 4.5