Skip to content

Commit 47a282f

Browse files
Update GizmoDrawer.cs
- Added some comments to HexToColor method. - Spelt colour incorrectly for the sake of uniformity.
1 parent dd75e3e commit 47a282f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Editor/GizmoDrawer.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ public class GizmoDrawer : MonoBehaviour
6767
#endregion
6868

6969
#region Public Methods
70-
public void SetColour(string hexCode) => SetColour(HexToColor(hexCode));
70+
public void SetColor(string hexCode) => SetColor(HexToColor(hexCode));
7171

72-
public void SetColour(Color colour)
72+
public void SetColor(Color color)
7373
{
74-
gizmoColor = colour;
74+
gizmoColor = color;
7575
}
7676
#endregion
7777

@@ -99,10 +99,12 @@ private static Color HexToColor(string hex)
9999
Debug.LogError("Invalid hex color code");
100100
}
101101

102+
// Convert hex code to byte
102103
byte r = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
103104
byte g = byte.Parse(hex.Substring(2, 2), System.Globalization.NumberStyles.HexNumber);
104105
byte b = byte.Parse(hex.Substring(4, 2), System.Globalization.NumberStyles.HexNumber);
105106

107+
// Divide by max byte value to clamp between 0 - 1.
106108
return new Color(r / 255f, g / 255f, b / 255f);
107109
}
108110
}

0 commit comments

Comments
 (0)