Unity-Technologies/UnityCsReference · error · ArgumentException
Could not find MaterialProperty: '{propertyName}', Num prope
Error message
Could not find MaterialProperty: '{propertyName}', Num properties: {properties.Length} What it means
Thrown by ShaderGUI.FindProperty when propertyIsMandatory is true and no MaterialProperty with the given name exists in the provided properties array. The base ShaderGUI assumes required shader properties are always present.
Source
Thrown at Editor/Mono/Inspector/ShaderGUI.cs:60
virtual public void ValidateMaterial(Material material)
{
}
// Utility methods
protected static MaterialProperty FindProperty(string propertyName, MaterialProperty[] properties)
{
return FindProperty(propertyName, properties, true);
}
protected static MaterialProperty FindProperty(string propertyName, MaterialProperty[] properties, bool propertyIsMandatory)
{
for (var i = 0; i < properties.Length; i++)
if (properties[i] != null && properties[i].name == propertyName)
return properties[i];
// We assume all required properties can be found, otherwise something is broken
if (propertyIsMandatory)
throw new ArgumentException("Could not find MaterialProperty: '" + propertyName + "', Num properties: " + properties.Length);
return null;
}
}
internal static class ShaderGUIUtility
{
private static Type ExtractCustomEditorType(string customEditorName)
{
if (string.IsNullOrEmpty(customEditorName))
return null;
// To allow users to implement their own ShaderGUI for the Standard shader we iterate in reverse order
// because the UnityEditor assembly is assumed first in the assembly list.
// Users can now place a copy of the StandardShaderGUI script in the project and start modifying that copy to make their own version.
var unityEditorFullName = $"UnityEditor.{customEditorName}"; // for convenience: adding UnityEditor namespace is not needed in the shader
foreach (var type in TypeCache.GetTypesDerivedFrom<ShaderGUI>())
{
if (type.FullName.Equals(customEditorName, StringComparison.Ordinal) ||View on GitHub (pinned to 225b0fbdb5)
Solutions
- Call FindProperty with propertyIsMandatory=false and null-check the result before use.
- Verify the shader declares the property name referenced by the ShaderGUI (case-sensitive).
- Update the ShaderGUI to match the current shader's property names.
Example fix
// before
var prop = FindProperty("_BaseColor", props, true);
// after
var prop = FindProperty("_BaseColor", props, false);
if (prop == null)
{
Debug.LogWarning($"Shader {material.shader.name} missing property _BaseColor");
return;
} Defensive patterns
Strategy: validation
Validate before calling
var prop = FindProperty(name, props, false); bool ok = prop != null;
Try / catch
try { FindProperty(name, props, true); }
catch (ArgumentException) { /* missing property, skip */ } Prevention
- Use propertyIsMandatory=false and null-check.
- Keep shader and ShaderGUI property names in sync.
When it happens
Trigger: A custom ShaderGUI calls FindProperty("_SomeName", props, true) but the material's shader does not declare that property. Shader changed/renamed a property while the ShaderGUI still references the old name.
Common situations: Shader renamed or removed a property after the ShaderGUI was written. ShaderGUI applied to a material whose shader lacks the expected properties. Typo in the property name string.
Related errors
- The SerializedProperty '{0}' is not supported by BeginProper
- The MaterialProperty '{0}' should be of type 'Texture' (its
- List of materials contains null
- Unknown vertex format {format}
- Missing name for {0}
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/97980467944ef732.
Report an issue: GitHub.