xxxxxxxxxx
I'm pretty new to Unity but I know that the Color constructor takes 3 parameters for r(red), g(green) and b(blue). If you understand better HEX colors than rgb ones, you should use an online converter to convert a HEX color you want to a rgb color. Then you can use :
float r ; // red component
float g ; // green component
float b ; // blue component
image.color = new Color(r,g,b) ;
xxxxxxxxxx
Color greenColor;
ColorUtility.TryParseHtmlString("#0AC742", out greenColor);
xxxxxxxxxx
using UnityEngine;
public class ColorSetter : MonoBehaviour
{
public string hexColor = "#FF0000"; // You can change this to your desired hexadecimal color
void Start()
{
// Convert hexadecimal string to a Color object
Color color = Color.white;
if (ColorUtility.TryParseHtmlString(hexColor, out color))
{
// Set the color of the object
Renderer renderer = GetComponent<Renderer>();
if (renderer != null)
{
renderer.material.color = color;
}
}
}
}