此脚本可以不需要手动挂载,放在项目中即可,需要的时候自动挂载 (下方红色代码实现此功能)
using UnityEngine;
using System.Collections;
[ExecuteInEditMode] //编辑状态也运行
[RequireComponent (typeof(Camera))] // 它修饰的类在需要时自动挂载在 指定的组件上
public class PostEffectsBase : MonoBehaviour
{
protected void Start()
{
CheckResources();
}
// Called when start
protected void CheckResources() {
bool isSupported = CheckSupport();
if (isSupported == false) {
NotSupported();
}
}
// Called in CheckResources to check support on this platform
protected bool CheckSupport() {
if (SystemInfo.supportsImage