Mechanim has a new function since 5.2 “SetBoneLocalRotation”
This function works great to set a rotation to a bone directly, sadly there is no way to get the bone current local rotation when using a “Optimize Game Objects” enabled Mechanim transform hierarchy. What we are requesting is a new function to get the local rotation. Something along the lines of “GetBoneLocalRotation” would work well.
The simple solution of exposing the necessary bone transforms and getting their local rotation will not work, because they return the local rotation in comparison to the root gameobject, not the their parent bone due to their Optimised status removing them from the hierarchy and placing them under the root gameobject.