diff --git a/Source/Editor/CustomEditors/CustomEditorsUtil.cs b/Source/Editor/CustomEditors/CustomEditorsUtil.cs index 316ae25aa..d6d2455d0 100644 --- a/Source/Editor/CustomEditors/CustomEditorsUtil.cs +++ b/Source/Editor/CustomEditors/CustomEditorsUtil.cs @@ -52,13 +52,18 @@ namespace FlaxEditor.CustomEditors // Check if use provided editor if (overrideEditor != null) return overrideEditor; + ScriptType targetType = values.Type; // Special case if property is a pure object type and all values are the same type - if (values.Type.Type == typeof(object) && values.Count > 0 && values[0] != null && !values.HasDifferentTypes) + if (targetType.Type == typeof(object) && values.Count > 0 && values[0] != null && !values.HasDifferentTypes) return CreateEditor(TypeUtils.GetObjectType(values[0]), canUseRefPicker); + // Special case if property is interface but the value is implemented as Scripting Object that should use reference picker + if (targetType.IsInterface && canUseRefPicker && values.Count > 0 && values[0] is FlaxEngine.Object) + return new DummyEditor(); + // Use editor for the property type - return CreateEditor(values.Type, canUseRefPicker); + return CreateEditor(targetType, canUseRefPicker); } internal static CustomEditor CreateEditor(ScriptType targetType, bool canUseRefPicker = true) diff --git a/Source/Editor/CustomEditors/Editors/DummyEditor.cs b/Source/Editor/CustomEditors/Editors/DummyEditor.cs new file mode 100644 index 000000000..8b952d2f1 --- /dev/null +++ b/Source/Editor/CustomEditors/Editors/DummyEditor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved. + +namespace FlaxEditor.CustomEditors.Editors +{ + internal sealed class DummyEditor : CustomEditor + { + public override void Initialize(LayoutElementsContainer layout) + { + string valueName; + if (Values.Count != 0 && Values[0] != null) + valueName = Values[0].ToString(); + else + valueName = "null"; + layout.Label($"{valueName} ({Values.Type})"); + } + } +}