如何在我的主相机上禁用太阳轴效果?

How to disable sunshaft effect on my main camera?

我的场景中有一个主摄像机,上面有一个 Sun Shafts (Script) ImageEffect。 (我正在使用中世纪环境资产。)

我想在主相机到达特定坐标时以编程方式禁用此效果。

这是我的 C# 脚本代码:

using UnityEngine;
using System.Collections;
using System;

    public class EnableComponents : MonoBehaviour
    {
        private SunShafts mySunShafts; //<<< Error CS0246 displays here (see below)


        void Start ()
        {
            mySunShafts = GetComponent<SunShafts>();
        }


        void Update ()
        {

            foreach(Camera c in GameObject.FindObjectsOfType(typeof(Camera))) 
            {
                if ((c.name == "Main Camera"))
                {
                    if ((c.transform.position.x < -10))
                    {
                        mySunShafts.enabled = false;
                    }
                }
            }
    }

SunShafts 的代码是这样开始的:

    @script ExecuteInEditMode
    @script RequireComponent (Camera)
    @script AddComponentMenu ("Image Effects/Sun Shafts")

    enum SunShaftsResolution {
        Low = 0,
        Normal = 1,
        High = 2,
    }

    enum ShaftsScreenBlendMode {
        Screen = 0,
        Add = 1,    
    }   

    class SunShafts extends PostEffectsBase 
    {       
        public var resolution : SunShaftsResolution = SunShaftsResolution.Normal;
        public var screenBlendMode : ShaftsScreenBlendMode = ShaftsScreenBlendMode.Screen;
...
...
...

当我尝试调试代码时,显示以下错误消息:

"Error CS0246: The type or namespace name 'SunShafts' could not be found (are you missing a using directive or an assembly reference?) (CS0246) (Assembly-CSharp)"

这里可以看到SunShaft效果和上面写的C#脚本属于同一个相机。但是(这是我的问题)这两个脚本只是 "cannot see each other".

那我做错了什么?为什么我的 C# 脚本 "cannot see" 而 Sun Shafts 脚本是用 JavaScript 编写的?我应该如何更改我的 C# 代码才能在运行时禁用我的相机上的 SunShafts 效果?

======================== 编辑 #1 ================== ====

C# 脚本已经在插件文件夹中:

这是错误消息:

===================== 编辑 #2 ===================== =========

这里是导入的标准资源:

现在UnityStandardAssets.ImageEffects没问题了;

但是我收到此错误消息:

您的代码缺少程序集导入,因此编译器找不到 SunShaft class。

地点

using UnityStandardAssets.ImageEffects;

低于

using System;

导入程序集。