我正在尝试禁用和禁用Component存储在List. 当我尝试这样做时,我收到以下错误:
“组件”不包含“已启用”的定义,并且找不到接受“组件”类型的第一个参数的扩展方法“已启用”(您是否缺少 using 指令或程序集引用?)
我也试过
components[4].SetActive(false);
Run Code Online (Sandbox Code Playgroud)
并得到类似的错误
public List<Component> components;
...
components = new List<Component>();
components.Add(player.GetComponent<_2dxFX_HSV1>());
components.Add(player.GetComponent<_2dxFX_HSV2>());
components.Add(player.GetComponent<_2dxFX_HSV3>());
components.Add(player.GetComponent<_2dxFX_HSV4>());
components.Add(player.GetComponent<_2dxFX_Negative>());
components.Add(player.GetComponent<_2dxFX_Lightning>());
components.Add(player.GetComponent<_2dxFX_MetalFX>());
components.Add(player.GetComponent<_2dxFX_Pixel8bitsC64>());
components.Add(player.GetComponent<_2dxFX_GoldFX>());
components.Add(player.GetComponent<_2dxFX_Waterfall>());
components.Add(player.GetComponent<_2dxFX_Hologram>());
components.Add(player.GetComponent<_2dxFX_PlasmaRainbow>());
components[4].enabled = false;
Run Code Online (Sandbox Code Playgroud)
如何禁用Component列表中的类型?