- Home /
Question by
WeirderChimp · Feb 13, 2015 at 04:50 AM ·
colorstringextensioncolor32extension-methods
Need some help with understanding Extensions
hey so im trying to make an extension so convert a color to a hex value eg 00ff00 would = green
this is my Script using UnityEngine; using System.Collections;
public static class HexConverter
{
public static void ColorToHex (this string hex, Color32 color)
{
hex = color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2");
Debug.Log(hex);
}
}
http://wiki.unity3d.com/index.php?title=HexConverter this is where im getting the converter
and to call this im using
void Start ()
{
ColorCode.ColorToHex(ActualColor);
}
ActualColor is a color 32 and Color code is a string
the problem im having is that Colorcode doesnt get changed to the colour code BUT in my extension Debug.Log(hex); puts out the correct infomation
Please help thanks ~Scott
Comment