シェーダーのプロパティに特定のプロパティ名が設定されているか確認します
See Also: Materials, ShaderLab documentation.
// Attach this to a gameObject that has a renderer. if(renderer.material.HasProperty("_Color")) renderer.material.SetColor("_Color",Color.red);
using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { void Example() { if (renderer.material.HasProperty("_Color")) renderer.material.SetColor("_Color", Color.red); } }
import UnityEngine import System.Collections public class ExampleClass(MonoBehaviour): def Example() as void: if renderer.material.HasProperty('_Color'): renderer.material.SetColor('_Color', Color.red)