MaterialsUseInstancingShader() static private method

static private MaterialsUseInstancingShader ( UnityEditor.SerializedProperty materialsArray ) : bool
materialsArray UnityEditor.SerializedProperty
return bool
        public override void OnInspectorGUI()
        {
            base.serializedObject.Update();
            bool flag = false;
            SerializedProperty serializedProperty = base.serializedObject.FindProperty("m_Materials");

            if (!serializedProperty.hasMultipleDifferentValues)
            {
                MeshFilter component = ((MeshRenderer)base.serializedObject.targetObject).GetComponent <MeshFilter>();
                flag = (component != null && component.sharedMesh != null && serializedProperty.arraySize > component.sharedMesh.subMeshCount);
            }
            EditorGUILayout.PropertyField(this.m_CastShadows, true, new GUILayoutOption[0]);
            bool disabled = SceneView.IsUsingDeferredRenderingPath();

            using (new EditorGUI.DisabledScope(disabled))
            {
                EditorGUILayout.PropertyField(this.m_ReceiveShadows, true, new GUILayoutOption[0]);
            }
            EditorGUILayout.PropertyField(this.m_MotionVectors, true, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_Materials, true, new GUILayoutOption[0]);
            if (!this.m_Materials.hasMultipleDifferentValues && flag)
            {
                EditorGUILayout.HelpBox("This renderer has more materials than the Mesh has submeshes. Multiple materials will be applied to the same submesh, which costs performance. Consider using multiple shader passes.", MessageType.Warning, true);
            }
            if (ShaderUtil.MaterialsUseInstancingShader(serializedProperty))
            {
                this.m_GameObjectsSerializedObject.Update();
                if (!this.m_GameObjectStaticFlags.hasMultipleDifferentValues && (this.m_GameObjectStaticFlags.intValue & 4) != 0)
                {
                    EditorGUILayout.HelpBox("This renderer is statically batched and uses an instanced shader at the same time. Instancing will be disabled in such a case. Consider disabling static batching if you want it to be instanced.", MessageType.Warning, true);
                }
            }
            base.RenderProbeFields();
            base.serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            // Evaluate displayMaterialWarning before drawing properties to avoid mismatched layout group
            bool displayMaterialWarning = false;

            if (!m_Materials.hasMultipleDifferentValues)
            {
                MeshFilter mf = ((MeshRenderer)serializedObject.targetObject).GetComponent <MeshFilter>();
                displayMaterialWarning = mf != null && mf.sharedMesh != null && m_Materials.arraySize > mf.sharedMesh.subMeshCount;
            }

            DrawMaterials();

            if (!m_Materials.hasMultipleDifferentValues && displayMaterialWarning)
            {
                EditorGUILayout.HelpBox(Styles.materialWarning.text, MessageType.Warning, true);
            }

            if (ShaderUtil.MaterialsUseInstancingShader(m_Materials))
            {
                m_GameObjectsSerializedObject.Update();

                if (!m_GameObjectStaticFlags.hasMultipleDifferentValues && ((StaticEditorFlags)m_GameObjectStaticFlags.intValue & StaticEditorFlags.BatchingStatic) != 0)
                {
                    EditorGUILayout.HelpBox(Styles.staticBatchingWarning.text, MessageType.Warning, true);
                }
            }

            LightingSettingsGUI(true);
            OtherSettingsGUI(true, false, false, true);

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            base.serializedObject.Update();
            this.LightingFieldsGUI();
            base.RenderRenderingLayer();
            bool flag = false;

            if (!this.m_Materials.hasMultipleDifferentValues)
            {
                MeshFilter component = ((MeshRenderer)base.serializedObject.targetObject).GetComponent <MeshFilter>();
                flag = (component != null && component.sharedMesh != null && this.m_Materials.arraySize > component.sharedMesh.subMeshCount);
            }
            EditorGUILayout.PropertyField(this.m_Materials, true, new GUILayoutOption[0]);
            if (!this.m_Materials.hasMultipleDifferentValues && flag)
            {
                EditorGUILayout.HelpBox(MeshRendererEditor.Styles.MaterialWarning, MessageType.Warning, true);
            }
            if (ShaderUtil.MaterialsUseInstancingShader(this.m_Materials))
            {
                this.m_GameObjectsSerializedObject.Update();
                if (!this.m_GameObjectStaticFlags.hasMultipleDifferentValues && (this.m_GameObjectStaticFlags.intValue & 4) != 0)
                {
                    EditorGUILayout.HelpBox(MeshRendererEditor.Styles.StaticBatchingWarning, MessageType.Warning, true);
                }
            }
            base.CullDynamicFieldGUI();
            base.serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            // Evaluate displayMaterialWarning before drawing properties to avoid mismatched layout group
            bool displayMaterialWarning = false;

            if (!m_Materials.hasMultipleDifferentValues)
            {
                MeshFilter mf = ((MeshRenderer)serializedObject.targetObject).GetComponent <MeshFilter>();
                displayMaterialWarning = mf != null && mf.sharedMesh != null && m_Materials.arraySize > mf.sharedMesh.subMeshCount;
            }

            using (new EditorGUI.DisabledScope(((MeshRenderer)serializedObject.targetObject).GetComponent <Tree>() != null))
            {
                DrawMaterials();
            }

            if (!m_Materials.hasMultipleDifferentValues && displayMaterialWarning)
            {
                EditorGUILayout.HelpBox(Styles.materialWarning.text, MessageType.Warning, true);
            }

            if (ShaderUtil.MaterialsUseInstancingShader(m_Materials))
            {
                m_GameObjectsSerializedObject.Update();

                int staticBatching, dynamicBatching;
                PlayerSettings.GetBatchingForPlatform(EditorUserBuildSettings.activeBuildTarget, out staticBatching, out dynamicBatching);

                if (!m_GameObjectStaticFlags.hasMultipleDifferentValues && ((StaticEditorFlags)m_GameObjectStaticFlags.intValue & StaticEditorFlags.BatchingStatic) != 0 && staticBatching != 0)
                {
                    EditorGUILayout.HelpBox(Styles.staticBatchingWarning.text, MessageType.Warning, true);
                }
            }

            LightingSettingsGUI(true);
            RayTracingSettingsGUI();
            OtherSettingsGUI(true, false, false);

            if (targets.Length == 1)
            {
                SpeedTreeMaterialFixer.DoFixerUI((target as MeshRenderer).gameObject);
            }

            serializedObject.ApplyModifiedProperties();
        }