… to have each part of a UI/in-game entity have its own script; i.e. an information panel, panel of buttons, a screen, a limb, a specific weapon, etc. or is it more efficient to have a larger script attached to a high-level GameObject that contains and updates many sub-elements? While it’s more extensible to write to the smallest element, I’m not sure that it’s the most efficient way to go. I know there’s probably exceptions either way but I’m just curious how most of y’all design larger-scale elements in Unity. TIA!
-Steve
It doesn’t matter. Use whatever works for you.
Generally it is best to use least interconnected scripts with minimum functionality (“this script enables a button and can’t do anything else” kind of thing), but that’s the extent of it. Use whatever works/whatever you’re comfortable with.
Honestly the answer is really going up to you. Performance isn’t going to a factor. The main difference is going to be maintainability and ease of updating and extending, which will be personal preference. I have done both ways (and many variations) on large and small games. Each will have positives and negatives depending on how heavy the ui is a particular game, how many people on the team, and how locked down the design is.