First of all, I am quite new to Unity. Actually what I mean by “animation” is pretty simple. I only change the color (or texture coordinate) of a cube over time. To make this simple animation smooth, I interpolate from the current color of the cube to its next color in a time interval (lerp functioanlity of unity). Let’s say I have 10 different colors for a cube to be represented in 20 seconds. After 20 seconds, it repeats the same animation. These 20 colors can be unique for each of the cubes. Therefore, I need to remember the colors assigned for that cube. I have written the code for the problem I just mentioned. My approach is to create a game object for each of the cube, set a script for that game object and initialise the array in the script, containing the color values to be represented over time. Then, in each update call, every cube updates its own color. So far so good. However, this approach only works once I have no more than 10000 cubes. I have another data that requires me to create about 80000 cubes in the screen. Once I try to create 80000 game objects, the frame per second drops dramatically, as you might guess. I’ve heard that I need to create mesh chunks if I will have huge number of objects in the screen. My question starts right here. If creating mesh chunks is the right approach for that problem, how am I going to handle the updating color values of each cube? Is it possible to pass an array to shader, and handle the updating color stuff in shaders for each cube? Or which approach should I try? Following image illustrates how the colored cubes look like. Imagine that there were 80000 cubes here and I want to change the color of each cube constantly.
The meshchunks approach you are describing is the concept know as Voxels. Search around and read up on it. The Unity Asset Store also have a Voxel plugin that might be useful. The game Minecraft uses the same technique and many have tried to create a similar game in Unity so searching around for Unity Minecraft might also yield some good results. Like this: http://in2gpu.com/2014/07/27/build-minecraft-unity-part-1/
Basically: Your color arrays cannot be stored on individual GameObjects but will have to be saved in a custom class containing all information for all the Cubes/Voxels.
