- Home /
How do I modify an existing default component?
By default component, I'm talking about the components that come pre-installed with unity when you download it. Take the Button component or the Box Collider. What I'm wondering is if it is possible to modify these components to add properties to them.
For example, Unity's Toggle component. Currently, the component only contains the "OnValueChanged" event. What I would like to do is add another event such as one that fires when the toggle is enabled and one when it becomes disabled. I'm just wondering if adding these properties is possible to existing components or would I have to make a custom component?
You have to create custom components for this, you cannot modify unity components code.
I recommend you to create a custom class that inherit and extends the unity's compoments, for example:
public class $$anonymous$$yToggle : Toggle{
// Custom code....
}
After all... that what inherit is for!