Fix handling invalid asset in AssetPicker instead of throwing exception
This commit is contained in:
@@ -59,7 +59,7 @@ namespace FlaxEditor.GUI
|
|||||||
if (_selectedItem == item)
|
if (_selectedItem == item)
|
||||||
return;
|
return;
|
||||||
if (!IsValid(item))
|
if (!IsValid(item))
|
||||||
throw new ArgumentException("Invalid asset type.");
|
return;
|
||||||
|
|
||||||
// Change value to scene reference (cannot load asset because scene can be already loaded - duplicated ID issue)
|
// Change value to scene reference (cannot load asset because scene can be already loaded - duplicated ID issue)
|
||||||
_selectedItem?.RemoveReference(this);
|
_selectedItem?.RemoveReference(this);
|
||||||
@@ -110,7 +110,7 @@ namespace FlaxEditor.GUI
|
|||||||
// Find item from content database and check it
|
// Find item from content database and check it
|
||||||
var item = value ? Editor.Instance.ContentDatabase.FindAsset(value.ID) : null;
|
var item = value ? Editor.Instance.ContentDatabase.FindAsset(value.ID) : null;
|
||||||
if (item != null && !IsValid(item))
|
if (item != null && !IsValid(item))
|
||||||
throw new ArgumentException("Invalid asset type.");
|
return;
|
||||||
|
|
||||||
// Change value
|
// Change value
|
||||||
_selectedItem?.RemoveReference(this);
|
_selectedItem?.RemoveReference(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user