Extending unity component and Adding listener?

Hello,

I would like to extend InputField component so that when the edit is done it calls another function.

Unity allows to subscribe to event by onEndEdit.AddListener(FunctionName) from outside, how can I do this from the inside (as I am extending)?

Regards.

1 Answer

1

That AddListener line works from the inside too. If you extend InputField you can access the onEndEdit event since it’s a public field of InputField, and derived class inherit all the public and protected fields.

But your question is weird, it sounds like you’re adding a feature that already exists, that’s what onEndEdit is used for.