I’ve researched this a bit, but still haven’t got it all figured out. Sorry for any ignorance.
I have the need to create several objects, not all of these will have visible game assets - some will be pure data (information for multiple players and groups of objects).
What is the favored approach (if there is one) of the following:
The “normal” approach in a non-visual environment: create classes and instance objects based on these.
Create prefabs (mostly without visible components like meshes), attach scripts to these and instantiate as needed.
Due to my background, I’m very familiar with the first (“normal”) approach, but have read that “pure” js-classes may be limited in how they can interact with the rest of the unity environment. Hence the question.
Performance and other aspects are of course interesting as well.
The only “limitation” objects that aren’t attached to gameobjects have is that they don’t get their Update() and FixedUpdate() (amongst others) called automatically.
I would probably go with the second approach, but mainly because I could have public variables that are exposed in the inspector, edit them when out of play-mode, and use the step-frame function during playmode to see them change.
Regarding perfromance, then a few empty game objects that aren’t being rendered practically have no performance overhead, so that wouldn’t affect my decision at all.
Just out of curiosity, do empty gameobjects (only containing scripts - no rendered meshes) without any instructions in Update (or without an Update function altogether) cause any overhead whatsoever?