- Home /
Storing list of some Type of Object vs storing list of GameObject: best practice
I worked on a decently large project these past 7 months or so, but still haven't really grasped what is best practice for storing references to GameObjects.
For most of the project we stored a list of GameObject and would reference their components when necessary. Is this best practice? Or is it better to store a list of the class of that GameObject (defined in a script) and then reference the GameObject through that class reference. Seeing as you can get the class/script reference through GetComponent() or you can get the GameObject through class.gameObject, I'm really hoping for clarification on if either way is best practice or if they're both fairly equal.
To build off this, and hopefully clarify, is it better to design a game around the scripts and instantiate the objects when necessary, or is it better to build it around the objects and reference their class scripts when necessary? Also if anyone has additional resources on this that would be awesome.
Your answer
Follow this Question
Related Questions
Can anyone help out form this problem please its urgent 1 Answer
Wave manager that enables multiple gameobjects after X seconds? 0 Answers
Rotate cube on y axis when I move my character on side of the cube 0 Answers
True Newbie; where to proceed 0 Answers
Does anyone know of good tutorials for learning arrays and classes? 1 Answer