if SetUnitPosition was a BJ ( non-native ) it would look like this. Please note that it still runs faster that SetUnitPositionLoc.
function SetUnitPosition takes unit u, real x, real y returns nothing
if x < GetRectMaxX( bj_mapInitialPlayableArea ) and x > GetRectMinX( bj_mapInitialPlayableArea ) and y < GetRectMaxY( bj_mapInitialPlayableArea ) and y > GetRectMinY( bj_mapInitialPlayableArea ) then
call SetUnitX( u, x )
call SetUnitY( u, y )
endif
call PauseUnit( u, true )
call PauseUnit( u, false )
endfunction
meaning that it runs faster, yet still resets orders and animations.
PS. to avoid Game Crashes, always use that condition ( the if/then ) there with SetUnitX/Y, as they can move the unit outside the map bounds.