I have a weird problem with my colors being darker

So I have this problem where I can manually put a color on something and it’s perfect, but when I change it’s color with a script, it becomes darker… as you can see in the screenshots. I’m pretty sure it has something to do with lighting but I’ve tried a lot of things and it’s just not working.

private void OnTriggerEnter2D(Collider2D col1)
    {
        if (col1.gameObject.name == "prplPatt")
        {
            col1.gameObject.transform.localScale += new Vector3(0.045f, 0.065f, 0f);
            col1.gameObject.GetComponent<Renderer>().material.color = new Color32(161, 0, 209, 255);
            coli = true;
        }
    }

    private void OnTriggerExit2D(Collider2D col)
    {
        if(col.gameObject.name == "prplPatt")
        {
            col.gameObject.transform.localScale += new Vector3(-0.045f, -0.065f, 0f);
            col.gameObject.GetComponent<Renderer>().material.color = new Color32(115, 0, 149, 255);
            coli = false;
        }
    }

198610-darker-colors-issue.jpg

Any time a new material is created, the area in Red is checked, and the area in Blue is not checked. For performance, AND colors not appearing darker it is best to have things selected the way they are shown.

So if you wish to create your colors through code, it would be wise to find the code calls to these mentioned, and enable/disable appropriately :slight_smile: