UnityEditor.ShaderUtil.HasFixedFunctionShaders C# (CSharp) Method

HasFixedFunctionShaders() private method

private HasFixedFunctionShaders ( Shader s ) : bool
s UnityEngine.Shader
return bool
        internal static extern bool HasFixedFunctionShaders(Shader s);
        [MethodImpl(MethodImplOptions.InternalCall)]

Usage Example

示例#1
0
        // "show fixed function shader" button
        private static void ShowFixedFunctionShaderButton(Shader s)
        {
            var hasFF = ShaderUtil.HasFixedFunctionShaders(s);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Fixed function", EditorStyles.miniButton);
            if (hasFF)
            {
                // check if this is a built-in shader (has no importer);
                // we can't show generated code in that case
                var builtinShader = (AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(s)) == null);
                if (!builtinShader)
                {
                    if (GUILayout.Button(Styles.showFF, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
                    {
                        ShaderUtil.OpenGeneratedFixedFunctionShader(s);
                        GUIUtility.ExitGUI();
                    }
                }
                else
                {
                    // See comment below why this is a button.
                    GUILayout.Button(Styles.builtinShader, GUI.skin.label);
                }
            }
            else
            {
                // Note: PrefixLabel is sometimes buggy if followed by a non-control (like Label).
                // We just want to show a label here, but have to pretend it's a button so it is treated like
                // a control.
                GUILayout.Button(Styles.no, GUI.skin.label);
            }
            EditorGUILayout.EndHorizontal();
        }
All Usage Examples Of UnityEditor.ShaderUtil::HasFixedFunctionShaders