- Home /
I made a custom UI element, is it appropriate to have it split into several classes or should it be contained in a single one?
I made a custom UI element based on some of Unity's source code. Well, two element that need to be used together to create a single behavior. I noticed that the UI elements Unity has don't exactly split up responsibilities among several objects. Rather they have all the code required for the element to function contained within a single class which you add as a component.
I have two classes that must be added to a game object to function correctly. Neither can function without the other. Would it be appropriate to combine them into a single class, following the patterns Unity uses for their UI classes?
I'm not going to post the code here since I'd rather keep it private for now, and because it's nearly 3,000 lines long. For proper structure and maintainability, what would you guys recommend?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How to animate RectTransform change in position 1 Answer
Options UI over all scenes 1 Answer
Render non-UI object next to a UI element on Screen Space - Overlay 0 Answers