Compare commits

..

3 Commits

Author SHA1 Message Date
github-actions[bot] 69943b46c8 feat: Update package.json to 1.4.0 2024-08-03 16:56:21 +00:00
Makihiro 66fc5ae911 Merge pull request #61 from mackysoft/feature/support-nested-private
SubclassSelector now support nested private type
2024-08-04 01:37:48 +09:00
Makihiro 1757747985 SubclassSelector now support nested private type 2024-08-04 01:37:09 +09:00
4 changed files with 2 additions and 89 deletions
@@ -5,8 +5,6 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using UnityEngine.UIElements;
using UnityEditor.UIElements;
namespace MackySoft.SerializeReferenceExtensions.Editor
{
@@ -112,21 +110,6 @@ namespace MackySoft.SerializeReferenceExtensions.Editor
EditorGUI.EndProperty();
}
public override VisualElement CreatePropertyGUI (SerializedProperty property)
{
VisualElement root = new VisualElement();
if (property.propertyType == SerializedPropertyType.ManagedReference)
{
TypePopupField typePopupField = new TypePopupField(property, new VisualElement());
root.Add(typePopupField);
}
else
{
return new Label(k_IsNotManagedReferenceLabel.text);
}
return root;
}
PropertyDrawer GetCustomPropertyDrawer (SerializedProperty property)
{
Type propertyType = ManagedReferenceUtility.GetType(property.managedReferenceFullTypename);
@@ -147,7 +130,7 @@ namespace MackySoft.SerializeReferenceExtensions.Editor
Type baseType = ManagedReferenceUtility.GetType(managedReferenceFieldTypename);
var popup = new AdvancedTypePopup(
TypeCache.GetTypesDerivedFrom(baseType).Append(baseType).Where(p =>
(p.IsPublic || p.IsNestedPublic) &&
(p.IsPublic || p.IsNestedPublic || p.IsNestedPrivate) &&
!p.IsAbstract &&
!p.IsGenericType &&
!k_UnityObjectType.IsAssignableFrom(p) &&
@@ -1,59 +0,0 @@
#if UNITY_2019_3_OR_NEWER
using UnityEditor;
using UnityEngine.UIElements;
namespace MackySoft.SerializeReferenceExtensions.Editor
{
public sealed class TypePopupField : BaseField<object>
{
public new static readonly string ussClassName = "unity-base-popup-field";
public static readonly string textUssClassName = ussClassName + "__text";
public static readonly string arrowUssClassName = ussClassName + "__arrow";
public new static readonly string labelUssClassName = ussClassName + "__label";
public new static readonly string inputUssClassName = ussClassName + "__input";
readonly SerializedProperty m_Property;
readonly Toggle m_Toggle;
readonly VisualElement m_ArrowElement;
readonly Label m_TextElement;
public TypePopupField (SerializedProperty property, VisualElement visualInput) : base(property.displayName, visualInput)
{
m_Property = property;
style.flexDirection = FlexDirection.Row;
style.flexShrink = 0;
style.flexGrow = 1;
AddToClassList(ussClassName);
AddToClassList("unity-base-field__aligned");
AddToClassList("unity-base-field__inspector-field");
labelElement.AddToClassList(labelUssClassName);
labelElement.AddToClassList("unity-popup-field__label");
labelElement.AddToClassList("unity-property-field__label");
m_TextElement = new Label(property.displayName)
{
pickingMode = PickingMode.Ignore
};
m_TextElement.AddToClassList(textUssClassName);
visualInput.AddToClassList(inputUssClassName);
visualInput.Add(m_TextElement);
visualInput.pickingMode = PickingMode.Ignore;
m_ArrowElement = new VisualElement();
m_ArrowElement.AddToClassList(arrowUssClassName);
m_ArrowElement.pickingMode = PickingMode.Ignore;
visualInput.Add(m_ArrowElement);
}
}
}
#endif
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: ad665a39f1251a14ea9f40c0c9cf3a75
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -2,7 +2,7 @@
"name": "com.mackysoft.serializereference-extensions",
"displayName": "SerializeReference Extensions",
"author": { "name": "MackySoft", "url": "https://github.com/mackysoft" },
"version": "1.3.1",
"version": "1.4.0",
"unity": "2021.3",
"description": "Provide popup to specify the type of the field serialized by the [SerializeReference] attribute in the inspector.",
"keywords": [ "SerializeReference", "Editor" ],