本文整理匯總了C#中UnityEditor.MaterialEditor.DefaultShaderProperty方法的典型用法代碼示例。如果您正苦於以下問題:C# MaterialEditor.DefaultShaderProperty方法的具體用法?C# MaterialEditor.DefaultShaderProperty怎麽用?C# MaterialEditor.DefaultShaderProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UnityEditor.MaterialEditor
的用法示例。
在下文中一共展示了MaterialEditor.DefaultShaderProperty方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnGUI
//.........這裏部分代碼省略.........
// }
case MaterialProperty.PropType.Color: // colors
{
EditorGUIUtility.labelWidth -= 30;
if (noAlphaFlag)
{
EditorGUI.ColorField(position, new GUIContent(label, ""), prop.colorValue, true, false, false, null);
}
else
{
editor.ColorProperty(position, prop, label);
}
break;
}
case MaterialProperty.PropType.Texture: // textures
{
EditorGUI.BeginChangeCheck();
if (miniThumbFlag)
{
editor.TexturePropertyMiniThumbnail(position, prop, label,"");
} else
{
editor.TextureProperty(position, prop, label, !noTileOffsetFlag);
}
if (EditorGUI.EndChangeCheck() && prop.textureValue!=null && sharedTextures!=null)
{
for(int j=0; j<sharedTextures.Length; j++)
{
foreach(Material mat in editor.targets)
{
if (mat.HasProperty(sharedTextures[j]))
{
mat.SetTexture(sharedTextures[j], prop.textureValue);
}
}
}
}
break;
}
case MaterialProperty.PropType.Vector: // vectors
{
if (byLayerFlag)
{
//
// affect single vector component depending on active layer
//
int layerNum = customEditor.active_layer;
float pval = prop.vectorValue[layerNum];
float nval;
if (minVal == maxVal)
{
// float
EditorGUIUtility.labelWidth -= 23;
nval = EditorGUI.FloatField(position, label, pval);
}
else
{
// slider
EditorGUIUtility.labelWidth = 160;
nval = EditorGUI.Slider(position, label, pval, minVal, maxVal);
}
if (pval!=nval)
{
for(int i=0; i< prop.targets.Length; i++)
{
Material mat = (prop.targets[i] as Material);
Vector4 vec = mat.GetVector(prop.name);
vec[layerNum] = nval;
mat.SetVector(prop.name, vec);
}
}
}
else
{
position.x += 12;
position.width -= 12;
editor.VectorProperty(position, prop, label);
}
break;
}
default:
{
if (customEditor.nextLabelWidth>0)
{
EditorGUIUtility.labelWidth = customEditor.nextLabelWidth;
customEditor.nextLabelWidth = 0;
} else
{
EditorGUIUtility.labelWidth -= 30;
}
editor.DefaultShaderProperty(position, prop, label);
break;
}
}
EditorGUI.EndDisabledGroup();
}
}
}