“。”运算符不能应用于类型“方法组”的操作数错误CS0023

时间:2018-11-26 12:07:22

标签: c# unity3d

我遇到此错误

  

“。”运算符不能应用于“方法组”类型的操作数

设置材料的颜色时。

这是我用来设置材料颜色的代码

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SetColor : MonoBehaviour 
{
    public Material[] CarMaterial;
    public GameObject[] LoadedCars;

    public void Yellow()
    {
        for (int z = 0; z < LoadedCars.Length; z++) 
        {
            if (PlayerPrefs.GetInt("CarToLoad") == z)
            {       
                CarMaterial[z].color = Color.red;
                //  a.color = Color.red;
            }
        }
    }
}

0 个答案:

没有答案