File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments