这个名字在当前上下文Unity脚本中不存在
本文关键字:Unity 上下文 脚本 不存在 | 更新日期: 2023-09-27 18:12:47
我这里漏掉了一些重要的东西,但我不知道是什么。
我有一个带有脚本的相机对象(NoiseAndGrain.cs)
using UnityEngine;
using System.Collections;
public class EventHandler : MonoBehaviour {
public GameObject cameraLeft;
public GameObject cameraRight;
void Start () {
if (GlobalVariables.grainON == false) {
cameraLeft.GetComponent<NoiseAndGrain>.enabled = false;
}
}
我正在读取相机对象,我可以调用附加到它的所有内容(GUI层,变换层,光晕层等)除了cs脚本。例如
cameraLeft.GetComponent<GUILayer>.enabled = false;
完美工作。
所有这些脚本都在标准资产目录下,我不明白是怎么回事。
任何想法?
我解决了,这太蠢了。
我没有使用UnityStandardAssets.ImageEffects;
顺便说一下,返回错误的那行是cameraLeft.GetComponent<NoiseAndGrain>.enabled = false;
当鼠标悬停在NoiseAndGrain(标记为红色)上时,我会得到这个错误
名称NoiseAndGrain在当前上下文中不存在