I am making a dictionary that would list 1000 words, and everytime one word is click, a panel will pop up and show 2 UI Object; Word Selected and Animation of that word.
Performance wise, how should I setup my game object ? Should it be a 1000 inactive gameobject and activate it depending on which word selected ? Or I create one gameobject and change animation programatically ?
One GameObject programmatically. The GameObject can have a UI Text for the word.
Separate data from code. I recommend a spreadsheet containing 1000 rows. Put the word in column A and the name of the sprite in column B. Save the spreadsheet in CSV format so it’s easy to read in a script, such as:
Animal,alligator
Boat,tugboat
Cat,housecat etc.
Put those sprites in a Resources folder so you can load them at runtime.
When the user clicks on a word, set the UI Text to the word. Use Resources.Load() to load the sprite, and instantiate it as a child of the GameObject, deleting any previously-instantiated sprite.
Given that the OP is asking at this level (“should I manually create 1000 separate GameObjects?”), Resources.Load is appropriate for the current degree of experience with Unity. And, given the purpose, there’s practically no difference between using a sprite atlas or loading from Resources; in this scenario they’d both be loading at start, and the size of the build would be the same. It’s just a matter of evaluating current experience level with Unity, and current requirements, and fitting an appropriate solution.
I have not tried it but in 2017, there is a new Sprite packer “Sprite atlas” - I understand it is pretty much as resources load (I.e. You would have to reference the individual sprites in code) but with the benefit of the sprites being in one or more textures. You basically have to create the Sprite atlas as an asset.
In the old world with Sprite packer, you could also just import them (I.e put them in your asset directory) give them all the same Sprite pack tag. Then you could drag them into an array / list and for convenience auto create a dictionary<string, sprite> and access them by file name. If you actually have not only one, but multiple sprites per word (you said animation) I think this approach could also work.
It’s not 100% clear to me what exactly you want…(are you having 1000 words and 1000 sprites or 1000 Sprite animations)