@@ -884,7 +884,7 @@ public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] pro
884884
885885 UpdateVersionInMaterial ( material ) ;
886886
887-
887+ _autoRenderQueue = ( int ) material . GetInt ( ShaderPropAutoRenderQueue ) ;
888888 _Transparent_Setting = ( _UTS_Transparent ) material . GetInt ( ShaderPropTransparentEnabled ) ;
889889 _StencilNo_Setting = material . GetInt ( ShaderPropStencilNo ) ;
890890
@@ -1445,108 +1445,11 @@ void GUI_OptionMenu(Material material)
14451445 {
14461446 EditorGUILayout . HelpBox ( "UTS : Applying Game Recommended Settings." , MessageType . Info ) ;
14471447 }
1448- #if false
1449- //v.2.0.7
1450- EditorGUILayout . BeginHorizontal ( ) ;
1451- EditorGUILayout . PrefixLabel ( "Remove Unused Keywords/Properties from Material" ) ;
1452- //GUILayout.Space(60);
1453- if ( GUILayout . Button ( "Execute" , middleButtonStyle ) )
1454- {
1455- RemoveUnusedKeywordsUtility ( material ) ;
1456- _RemovedUnusedKeywordsMessage = true ;
1457- }
1458- EditorGUILayout . EndHorizontal ( ) ;
1459- if ( _RemovedUnusedKeywordsMessage ) {
1460- EditorGUILayout . HelpBox ( "UTS2 : Unused Material Properties and ShaderKeywords are removed." , MessageType . Info ) ;
1461- }
1462- #endif
1463- //
1464- }
1465-
1466- //v.2.0.7
1467- void RemoveUnusedKeywordsUtility ( Material material )
1468- {
1469- RemoveUnusedMaterialProperties ( material ) ;
1470- RemoveShaderKeywords ( material ) ;
1471- }
14721448
1473- void RemoveShaderKeywords ( Material material )
1474- {
1475- string shaderKeywords = "" ;
14761449
1477- if ( material . HasProperty ( "_EMISSIVE" ) )
1478- {
1479- float outlineMode = material . GetFloat ( "_EMISSIVE" ) ;
1480- if ( outlineMode == 0 )
1481- {
1482- shaderKeywords = shaderKeywords + "_EMISSIVE_SIMPLE" ;
1483- }
1484- else
1485- {
1486- shaderKeywords = shaderKeywords + "_EMISSIVE_ANIMATION" ;
1487- }
1488- }
1489- if ( material . HasProperty ( ShaderPropOutline ) )
1490- {
1491- float outlineMode = material . GetFloat ( ShaderPropOutline ) ;
1492- if ( outlineMode == 0 )
1493- {
1494- shaderKeywords = shaderKeywords + " _OUTLINE_NML" ;
1495- }
1496- else
1497- {
1498- shaderKeywords = shaderKeywords + " _OUTLINE_POS" ;
1499- }
1500- }
1501-
1502- var so = new SerializedObject ( material ) ;
1503- so . Update ( ) ;
1504- so . FindProperty ( "m_ShaderKeywords" ) . stringValue = shaderKeywords ;
1505- so . ApplyModifiedProperties ( ) ;
15061450 }
15071451
1508- // http://light11.hatenadiary.com/entry/2018/12/04/224253
1509- void RemoveUnusedMaterialProperties ( Material material )
1510- {
1511- var sourceProps = new SerializedObject ( material ) ;
1512- sourceProps . Update ( ) ;
1513-
1514- var savedProp = sourceProps . FindProperty ( "m_SavedProperties" ) ;
1515-
1516- // Tex Envs
1517- var texProp = savedProp . FindPropertyRelative ( "m_TexEnvs" ) ;
1518- for ( int i = texProp . arraySize - 1 ; i >= 0 ; i -- )
1519- {
1520- var propertyName = texProp . GetArrayElementAtIndex ( i ) . FindPropertyRelative ( "first" ) . stringValue ;
1521- if ( ! material . HasProperty ( propertyName ) )
1522- {
1523- texProp . DeleteArrayElementAtIndex ( i ) ;
1524- }
1525- }
1526-
1527- // Floats
1528- var floatProp = savedProp . FindPropertyRelative ( "m_Floats" ) ;
1529- for ( int i = floatProp . arraySize - 1 ; i >= 0 ; i -- )
1530- {
1531- var propertyName = floatProp . GetArrayElementAtIndex ( i ) . FindPropertyRelative ( "first" ) . stringValue ;
1532- if ( ! material . HasProperty ( propertyName ) )
1533- {
1534- floatProp . DeleteArrayElementAtIndex ( i ) ;
1535- }
1536- }
1537-
1538- // Colors
1539- var colorProp = savedProp . FindPropertyRelative ( "m_Colors" ) ;
1540- for ( int i = colorProp . arraySize - 1 ; i >= 0 ; i -- )
1541- {
1542- var propertyName = colorProp . GetArrayElementAtIndex ( i ) . FindPropertyRelative ( "first" ) . stringValue ;
1543- if ( ! material . HasProperty ( propertyName ) )
1544- {
1545- colorProp . DeleteArrayElementAtIndex ( i ) ;
1546- }
1547- }
1548- sourceProps . ApplyModifiedProperties ( ) ;
1549- }
1452+
15501453 //
15511454 void OpenOptimizationForGameWindow ( Material material )
15521455 {
0 commit comments