I am interested in making a custom version of Input Field, that would function as a more comprehensive “Text Editor” component. What would be the best way for me to implement “Text Editor”? Should it be a component at the same level as InputField.cs? I am guessing not, and that instead Text Editor should inherit from Input Field? Is it possible to inherit from Input Field, rather than the usual MonoBehaviour?
Yes, you can derive from Input Field. I’ve done that once for fun to add some personal touches to it
small note: If you’re interested, you could get yourself a free copy of TextMeshPro , on the asset store (which will someday be integrated into Unity). It has some nice additional features that you might want to use and/or that you might have wanted to do in your custom version, etc… (I think that you can extend that, also, but I can’t remember if I’ve tried or not. – and while the free version won’t give you source code, but it may still be worth a look).
i was just about to start a new thread on input field inheritance. the problem with inheriting directly is that many of the methods are protected or private. for any customization of the default behavior you really have to change the class.
@Stephan-B is there any compelling reason not to make methods virtual and properties public/protected rather than private? i’ve only glanced through the repo a few times. maybe base class issues prevent it. the advantage would be we could derive from input field and override say Select or LateUpdate without having to compile our own UI DLL and altering everyone’s installs. we’re really fighting with those issues in one of our current projects right now because it needs to behave differently than the default. and yes, maybe i should start a new thread on that