Unity3d 编辑器中 Shader 属性导出
本例用于导出TerrainForMobile/3TexturesDiffuseSimple 的shader的贴图和缩放导出
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 ) { } } }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。