本文整理匯總了C#中UnityEditor.MaterialEditor.PropertiesChanged方法的典型用法代碼示例。如果您正苦於以下問題:C# MaterialEditor.PropertiesChanged方法的具體用法?C# MaterialEditor.PropertiesChanged怎麽用?C# MaterialEditor.PropertiesChanged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UnityEditor.MaterialEditor
的用法示例。
在下文中一共展示了MaterialEditor.PropertiesChanged方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnGUI
//.........這裏部分代碼省略.........
}
//Shader Flags
GUILayout.Label("Features", EditorStyles.boldLabel);
string features = "";
if(mShaderFeatures != null)
{
foreach(string flag in mShaderFeatures)
{
features += flag + ", ";
}
}
if(features.Length > 0)
features = features.Substring(0, features.Length-2);
GUILayout.Label(features, EditorStyles.wordWrappedMiniLabel);
//Shader Keywords
GUILayout.Label("Keywords", EditorStyles.boldLabel);
string keywords = "";
foreach(string keyword in keywordsList)
{
keywords += keyword + ", ";
}
if(keywords.Length > 0)
keywords = keywords.Substring(0, keywords.Length-2);
GUILayout.Label(keywords, EditorStyles.wordWrappedMiniLabel);
#endif
//--------------------------------------------------------------------------------------
if(EditorGUI.EndChangeCheck())
{
materialEditor.PropertiesChanged();
}
}
//Update Keywords
if(updateKeywords)
{
if(materialEditor.targets != null && materialEditor.targets.Length > 0)
{
foreach(Object t in materialEditor.targets)
{
(t as Material).shaderKeywords = keywordsList.ToArray();
EditorUtility.SetDirty(t);
}
}
else
{
targetMaterial.shaderKeywords = keywordsList.ToArray();
EditorUtility.SetDirty(targetMaterial);
}
}
//Update Variant
if(updateVariant && !isGeneratedShader)
{
string baseName = isMobileShader ? BASE_SHADER_NAME_MOB : BASE_SHADER_NAME;
string newShader = baseName;
for(int i = 0; i < ShaderVariants.Count; i++)
{
if(ShaderVariantsEnabled[i])
{
newShader += " " + ShaderVariants[i];