- Home /
How to allow custom classes, to be a variant of sealed unity classes, and allow selecting either, in existing inspectors.
Let’s say I make a new custom version/variant of an existing unity type: like say a UI.Text
I program it with all the same functions and properties as the original unity based class. However I don’t have the ability to declare my class as a descendant of the unity classes (original class is “sealed”), nor is there any kind of IAmAUIText interface, that I can implement.
Question: How can I get my custom class to be accepted, wherever the original class was accepted, in the unity editor? Particularly, built-in inspector ObjectFields that accept only the original class.
I’m aware of the ability to create an implicit cast between the original and new version of a given class, which makes conversion between the two work as expected when coding. But I have no idea how to grant these new classes the ability to be selected by the user, in editor/inspector ObjectFields, wherever one of the original classes is selectable. Ideally, when the system shows an ObjectField selection list for a built-in class, it would show existing items from both the original AND new variant of the class.
I’m NOT looking to create an editor control to do this, my hope is to make this work on built-in inspectors too.
I would have thought this is not possible, but I’ve seen advertisements for unity assets that, at least sound like they, can do this.
Your answer
Follow this Question
Related Questions
Inspector button for custom class 1 Answer
Custom inheritance classes and custom inspectors 2 Answers
How do you make a custom inspector for a class or instance? 3 Answers
EditorGUI add SortingLayer-like list to custom Editor 1 Answer
Non-MonoBehaviour class exists in scene, constantly calling itself 2 Answers