本例用于导出TerrainForMobile/3TexturesDiffuseSimple 的shader的贴图和缩放导出
class="brush:csharp;gutter:true;">protected const string SHADER_FILTER = "TerrainForMobile/3TextureDiffuseSimple";
public void parse(GameObject go)
{
//判空就不写了
Renderer renderer = go.renderer;
Material mat = renderer.sharedMaterial;
Shader shader = mat.shader;
int count = ShaderUtil.GetPropertyCount(shader);
for ( int index = 0; index < count; ++index )
{
ShaderUtil.ShaderPropertyType type = ShaderUtil.GetPropertyType(shader, index);
string propertyName = ShaderUtil.GetPropertyName(shader, index);
if ( ShaderUtil.ShaderPropertyType.TexEnv == type )
{
Debug.log( "ShaderPropertyName:" + propertyName );
Texture texture = mat.GetTexture(propertyName);
Debug.log( "ShaderPropertyName:" + texture.ToString() );
Vector2 textureScale = mat.GetTextureScale(propertyName);
Debug.log( "textureScale:" + textureScale.ToString() );
Vector2 textureOffset = mat.GetTextureScale(propertyName);
Debug.log( "textureOffset:" + textureOffset.ToString() );
}
else if ( ShaderUtil.ShaderPropertyType.Color == type )
{
}
}
}