Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPROVE] UI Toolkit Support #51

Closed
Wuzseen opened this issue Jan 26, 2024 · 1 comment
Closed

[IMPROVE] UI Toolkit Support #51

Wuzseen opened this issue Jan 26, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Wuzseen
Copy link

Wuzseen commented Jan 26, 2024

Improvement: UI Toolkit Support

Hello! This is a great little extension--makes SerializeReference much more useful out of the box.

Due to Unity's restrictions/issues with UI tooolkit and IMGUI inspectors clashing, it would be nice to have UI Toolkit version of the subclass selector implemented.

I did this locally just to quickly unblock something. Simply added this method to SubclassSelectorDrawer. I'd make a PR but I'm not sure this is how you'd want to do it with your package anyway. It doesn't totally match the styling of your IMGUI implementation.

        public override VisualElement CreatePropertyGUI(SerializedProperty property)
        {
            VisualElement root = new();

            if (property.propertyType == SerializedPropertyType.ManagedReference)
            {
                Button dropdownButton = null;
                dropdownButton = new Button(() =>
                {
                    TypePopupCache popup = this.GetTypePopup(property);
                    this.m_TargetProperty = property;
                    popup.TypePopup.Show(dropdownButton.contentRect);
                });

                dropdownButton.text = this.GetTypeName(property).text;
                root.Add(dropdownButton);

                PropertyField propertyField = new(property);
                root.Add(propertyField);
            }
            else
            {
                TextField text = new(SubclassSelectorDrawer.k_IsNotManagedReferenceLabel.text);
                root.Add(text);
            }

            return root;
        }
@Wuzseen Wuzseen added the enhancement New feature or request label Jan 26, 2024
@mackysoft
Copy link
Owner

@Wuzseen
Sorry for the delay.

To apply an implementation using VisualElements to this library, it is necessary to resolve issues related to version compatibility and drawing compatibility with IMGUI. Therefore, the priority of implementation in my roadmap is likely to be low.

Please feel free to reopen if there is anything else. Contributions are welcome!

@mackysoft mackysoft closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants