#Maybe share the whole script

1 messages · Page 1 of 1 (latest)

somber swift
#
    private Dictionary<string, Color> colors = new Dictionary<string, Color>();
    public string neededCol;

    void Start()
    {
        //rekler
        colors.Add("red", new Color(1f, 0, 0));
        colors.Add("green", new Color(0, 1f, 0));
        colors.Add("blue", new Color(0, 0.56f, 1f));
        colors.Add("pınk", new Color(1f, 0, 0.96f));
        colors.Add("purple", new Color(0.34f, 0, 0.98f));
        colors.Add("yellow", new Color(0.96f, 0.98f, 0.03f));
        colors.Add("orange", new Color(0.98f, 0.52f, 0.03f));
        colors.Add("black", new Color(0f, 0f, 0f));
        colors.Add("whıte", new Color(1f, 1f, 1f));

        Debug.Log(neededCol);//no error
        paintObj.GetComponent<Image>().color = colors[neededCol]; //error her
    }
mossy pebble
#

That's a different line than you said had the error before

#

Either paintObj is null or has no Image component