Unity-Technologies/UnityCsReference · error · ArgumentNullException
property
Error message
property
What it means
Thrown by ObjectSelector.Show when the SerializedProperty argument is null. The object-selector requires a valid property to read objectReferenceValue and bind the edited target object.
Source
Thrown at Editor/Mono/ObjectSelector.cs:604
{
return (String.Equals(typeof(AudioMixerGroup).Name, typeStr));
}
internal void Show(Type requiredType, SerializedProperty property, bool allowSceneObjects, List<EntityId> allowedEntityIds = null, Action<UnityObject> onObjectSelectorClosed = null, Action<UnityObject> onObjectSelectedUpdated = null, bool allowBuiltinResources = true, bool excludeSceneAssets = false)
{
Show(new [] { requiredType }, property, allowSceneObjects, allowedEntityIds, onObjectSelectorClosed, onObjectSelectedUpdated, allowBuiltinResources, excludeSceneAssets);
}
internal void Show(Type[] requiredTypes, SerializedProperty property, bool allowSceneObjects, List<EntityId> allowedEntityIds = null, Action<UnityObject> onObjectSelectorClosed = null, Action<UnityObject> onObjectSelectedUpdated = null, bool allowBuiltinResources = true, bool excludeSceneAssets = false)
{
if (requiredTypes == null)
{
// Required type list handles null elements if a property exists.
requiredTypes = new Type [] { null };
}
if (property == null)
throw new ArgumentNullException(nameof(property));
// Don't select anything on multi selection
UnityObject obj = property.hasMultipleDifferentValues ? null : property.objectReferenceValue;
UnityObject objectBeingEdited = property.serializedObject.targetObject;
m_EditedProperty = property;
SharedShow(obj, new RequiredTypeList(requiredTypes, property), objectBeingEdited, allowSceneObjects, allowedEntityIds, onObjectSelectorClosed, onObjectSelectedUpdated, true, allowBuiltinResources, excludeSceneAssets);
}
internal void Show(UnityObject obj, Type requiredType, UnityObject objectBeingEdited, bool allowSceneObjects, List<EntityId> allowedEntityIds = null, Action<UnityObject> onObjectSelectorClosed = null, Action<UnityObject> onObjectSelectedUpdated = null, bool showNoneItem = true, bool allowBuiltinResources = true, bool excludeSceneAssets = false)
{
Show(obj, new Type[] { requiredType }, objectBeingEdited, allowSceneObjects, allowedEntityIds, onObjectSelectorClosed, onObjectSelectedUpdated, showNoneItem, allowBuiltinResources, excludeSceneAssets);
}
internal void Show(UnityObject obj, Type[] requiredTypes, UnityObject objectBeingEdited, bool allowSceneObjects, List<EntityId> allowedEntityIds = null, Action<UnityObject> onObjectSelectorClosed = null, Action<UnityObject> onObjectSelectedUpdated = null, bool showNoneItem = true, bool allowBuiltinResources = true, bool excludeSceneAssets = false)
{
SharedShow(View on GitHub (pinned to 225b0fbdb5)
Solutions
- Verify the property path: serializedObject.FindProperty("path") != null before calling Show.
- Refresh the SerializedObject before property lookups.
- Use the obj-based Show overload if you have a direct UnityObject reference instead.
Example fix
// before
var prop = so.FindProperty("maybeMissing");
ObjectSelector.get.Show(new[]{ typeof(Material) }, prop, ...);
// after
var prop = so.FindProperty("maybeMissing");
if (prop == null) { Debug.LogError("property missing"); return; }
ObjectSelector.get.Show(new[]{ typeof(Material) }, prop, ...); Defensive patterns
Strategy: validation
Validate before calling
var prop = so.FindProperty("path");
if (prop != null) ObjectSelector.get.Show(types, prop, ...); Prevention
- Verify property paths before lookup.
- Refresh the SerializedObject before FindProperty.
- Use the obj-based Show overload when possible.
When it happens
Trigger: Calling ObjectSelector.Show(...) with property == null after the requiredTypes null-default branch.
Common situations: SerializedProperty lookup returned null because the property path was wrong or the serializedObject changed; editor code invoking the selector without checking the property exists.
Related errors
- Cannot add dependency on invalid ArtifactKey.
- The object to add cannot be null.
- The object to remove cannot be null.
- Platform GUID {platformGuid} is not a valid Unity build plat
- rendererIDs and results NativeArrays don't match in length.
AI-assisted analysis of Unity-Technologies/UnityCsReference@225b0fbdb5 (2026-08-13).
Data as JSON: /api/errors/e6082b6feff6a008.
Report an issue: GitHub.