Skip to content

Instantly share code, notes, and snippets.

@s2kw
Created February 1, 2016 22:25
Show Gist options
  • Save s2kw/3380af5f3aa0be45d531 to your computer and use it in GitHub Desktop.
Save s2kw/3380af5f3aa0be45d531 to your computer and use it in GitHub Desktop.
Shaderのアクセス可能な変数を見る for Standard shader
using UnityEngine;
using System;
using UnityEditor;
using System.Collections.Generic;
[ExecuteInEditMode]
public class CheckShader: MonoBehaviour
{
void OnEnable ()
{
Shader s = GetComponent<MeshRenderer>().sharedMaterial.shader;
List<String> props = new List<String>();
for ( int i = 0; i < ShaderUtil.GetPropertyCount( s ); ++i )
props.Add( ShaderUtil.GetPropertyName( s, i ) );
Debug.Log( String.Join("\n", props.ToArray()) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment