General Scripting Etiquette

Aloha.

Since I have no technical issues with C# itself, I had a more general question with how Unity handles multiple layers of scripting.

By force of habit I have multiple layers of scripts but tend to encompass all aspects about an entity - object or child - into one consolidated file
I do this with the intention of hot-swapping elements within the lower, child processes in order for dynamic feedback into the parent script without altering the behavior of other children or the parent object as a whole.

My background is in coding features for various non-Unity projects and this is my usual methodology. (Minimum Files with orderly calls to other scripts. Less Confetti and Less Spaghetti)

Question of the Day:
Will this come back to bite me in the ass down the road? Does Unity handle this and I’m simply being redundant? Will this effect performance and the ultimate file-size?

Thanks for any input you have on the matter. I’m picky for optimization but if it’s not that huge of a deal I may relax just a bit and just work script by script with the knowledge that Unity will handle any compression/file consolidation in the post- processing.

Here is some timing diagram help:

1 Like

Thanks, mate. Having the Order of Execution under UNITY will definitely help.

In fact, it answers more questions I had than I initially asked.

Kudos, Muchachos.

Awesome. The pattern I use is to try set stuff up so I don’t care about order between scripts, and when I do want it, I always explicitly call one script from the other using a public method and GetComponent to get the other script.

I don’t like using script execution order because it is out of sight of the code, and if you copy a couple of files from one project to the other in the future, you won’t (necessarily) be copying the execution order and then you’ll have mysterious errors.

2 Likes