Shader.isSupported 是否支持

var isSupported : bool

Description描述

Can this shader run on the end-users graphics card? (Read Only)

可以在终端用户的图形卡上运行这个着色器么?(只读)

Returns true if the shader itself or any fallbacks setup in the shader are supported. Most often you use this when implementing special effects. For example, image effects in Unity Pro automatically disable themselves if the shader is not supported.

如果这个着色器自身和任何fallback的设置被支持,返回true。在实现特定的效果时, 最常使用这个。例如,着色器不支持,在Unity Pro中的image effects,将自动禁用。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Awake() {
		if (!renderer.material.shader.isSupported)
			renderer.enabled = false;

	}
}
// Disable renderer if material's shader is not supported
//如果材质的着色器不支持,禁用渲染器

if (!renderer.material.shader.isSupported)
	renderer.enabled = false;

参见: Material

Page last updated: 2011-3-31