Shader.isSupported 是否支持

var isSupported : bool


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