GetPropertyType() private méthode

private GetPropertyType ( Shader s, int propertyIdx ) : ShaderPropertyType
s UnityEngine.Shader
propertyIdx int
Résultat ShaderPropertyType
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent content)
        {
            var att = (ShaderPropertyPopupAttribute)attribute;

            var directable = prop.serializedObject.targetObject as IDirectable;

            if (directable != null)
            {
                var actor = directable.actor;
                if (actor != null)
                {
                    var renderer = actor.GetComponent <Renderer>();
                    if (renderer != null)
                    {
                        var material = renderer.sharedMaterial;
                        if (material != null)
                        {
                            var shader  = material.shader;
                            var options = new List <string>();
                            for (var i = 0; i < ShaderUtil.GetPropertyCount(shader); i++)
                            {
                                if (ShaderUtil.IsShaderPropertyHidden(shader, i))
                                {
                                    continue;
                                }

                                if (att.propertyType != null)
                                {
                                    var type = ShaderUtil.GetPropertyType(shader, i);
                                    if (att.propertyType == typeof(Color) && type != ShaderUtil.ShaderPropertyType.Color)
                                    {
                                        continue;
                                    }
                                    if (att.propertyType == typeof(Texture) && type != ShaderUtil.ShaderPropertyType.TexEnv)
                                    {
                                        continue;
                                    }
                                    if (att.propertyType == typeof(float) && type != ShaderUtil.ShaderPropertyType.Float && type != ShaderUtil.ShaderPropertyType.Range)
                                    {
                                        continue;
                                    }
                                    if ((att.propertyType == typeof(Vector2) || att.propertyType == typeof(Vector4)) && type != ShaderUtil.ShaderPropertyType.Vector)
                                    {
                                        continue;
                                    }
                                }

                                options.Add(ShaderUtil.GetPropertyName(shader, i));
                            }

                            prop.stringValue = EditorTools.CleanPopup <string>(content.text, prop.stringValue, options);
                            return;
                        }
                    }
                }
            }

            prop.stringValue = EditorGUILayout.TextField(content.text, prop.stringValue);
        }
        private string GenerateMultiMaterialinformation()
        {
            string result;

            if (base.targets.Count <UnityEngine.Object>() > 1)
            {
                result = "";
            }
            else
            {
                VideoPlayer videoPlayer = base.target as VideoPlayer;
                if (!videoPlayer)
                {
                    result = "";
                }
                else
                {
                    Renderer targetRenderer = VideoPlayerEditor.GetTargetRenderer(videoPlayer);
                    if (!targetRenderer)
                    {
                        result = "";
                    }
                    else
                    {
                        Material[] sharedMaterials = targetRenderer.sharedMaterials;
                        if (sharedMaterials == null || sharedMaterials.Count <Material>() <= 1)
                        {
                            result = "";
                        }
                        else
                        {
                            List <string> list  = new List <string>();
                            Material[]    array = sharedMaterials;
                            for (int i = 0; i < array.Length; i++)
                            {
                                Material material = array[i];
                                if (material)
                                {
                                    int j             = 0;
                                    int propertyCount = ShaderUtil.GetPropertyCount(material.shader);
                                    while (j < propertyCount)
                                    {
                                        if (ShaderUtil.GetPropertyType(material.shader, j) == ShaderUtil.ShaderPropertyType.TexEnv && ShaderUtil.GetPropertyName(material.shader, j) == this.m_TargetMaterialProperty.stringValue)
                                        {
                                            list.Add(material.name);
                                            break;
                                        }
                                        j++;
                                    }
                                }
                            }
                            if (list.Count <string>() == sharedMaterials.Count <Material>())
                            {
                                result = VideoPlayerEditor.s_Styles.texPropInAllMaterialsHelp;
                            }
                            else
                            {
                                result = string.Format(VideoPlayerEditor.s_Styles.texPropInSomeMaterialsHelp, list.Count <string>(), sharedMaterials.Count <Material>()) + ": " + string.Join(", ", list.ToArray());
                            }
                        }
                    }
                }
            }
            return(result);
        }