报错:The name 'PostEffectsBase' does not denote a valid type ('not found').
最近看入门精要的时候,发现新版本删掉了这个脚本,单独发一下"PostEffectsBase.cs" 方便想找的人
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
[RequireComponent (typeof(Camera))]
public class PostEffectsBase : MonoBehaviour {
// 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.supportsImageEffects == false || SystemInfo.supportsRenderTextures == false) {
Debug.LogWarning("This platform does not support image effects or render textures.");
return false;
}
return true;
}
// Called when the platform doesn't support this effect
protected void NotSupported() {
enabled = false;
}
protected void Start() {
CheckResources();
}
// Called when need to create the material used by this effect
protected Material CheckShaderAndCreateMaterial(Shader shader, Material material) {
if (shader == null) {
return null;
}
if (shader.isSupported && material && material.shader == shader)
return material;
if (!shader.isSupported) {
return null;
}
else {
material = new Material(shader);
material.hideFlags = HideFlags.DontSave;
if (material)
return material;
else
return null;
}
}
}

本文详细解析了Unity中被删除的PostEffectsBase脚本,该脚本用于实现后期处理效果,如检查平台支持、创建材质等。文章提供了脚本的源代码,并解释了如何在不支持的平台上禁用效果。

953

被折叠的 条评论
为什么被折叠?



