我遇到此错误
“。”运算符不能应用于“方法组”类型的操作数
设置材料的颜色时。
这是我用来设置材料颜色的代码
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;
}
}
}
}