Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Additional clarity on 'snap' in Handles documentation

Discussion in 'Documentation' started by Tinovdk, Jul 18, 2016.

  1. Tinovdk

    Tinovdk

    Joined:
    Nov 28, 2013
    Posts:
    83
    The documentation in several entries of the Handles section could be improved by explaining that the user needs to use the platform-dependent action modifier key for the snapping to work.

    I suggest the following replacement text in the <para> blocks:

    Code (CSharp):
    1. // UnityEditor.Handles
    2. /// <summary>
    3. ///   <para>Rounds the value val to the closest multiple of snap if the platform-dependent "action" modifier key is held down. Note: snap can only be positive.</para>
    4. /// </summary>
    5. /// <param name="val"></param>
    6. /// <param name="snap"></param>
    7. /// <returns>
    8. ///   <para>The rounded value, if action key is held and snap is positive, and val otherwise.</para>
    9. /// </returns>
    10. public static float SnapValue(float val, float snap)
    11. {
    12.     if (EditorGUI.actionKey && snap > 0f)
    13.     {
    14.         return Mathf.Round(val / snap) * snap;
    15.     }
    16.     return val;
    17. }
     
  2. Alex_May

    Alex_May

    Joined:
    Dec 29, 2013
    Posts:
    198
    Thanks for this, sorry for the late reply. Agreed - looking at e.g. Handles.FreeMoveHandle it's not only Mac-specific but also contains a typo. I will look at these and get them drawn up for correction. Thanks very much!