To fix them, I had to do the following:
- Make a copy of all the materials that change colors and replace the materials with their copies for their corresponding objects (at runtime). This is necessary because there are only two ways to modify a material's color. The first way is to call renderer.material, but this makes a copy of the material each time it is called (for each object). The second way is to just change the color of the material at runtime and all objects that use the material change color as well. The problem there is that the change is persistent. In other words, it changes the meta file for the material in the Unity editor (which is bad news when you're working with a repository). Instead we created a copy of each material and modified that instead.
- Reduce the number of prefabs used per platform. Each platform is a multiple of three in length and was made up of 3x1 pieces. That's a lot of pieces for 255x1 platform. Instead I modified all of the platform prefabs to be made up of only three pieces (left, stretched center, and right). This prevented too many update calls from being made.
It was tedious and time consuming work, but now the game is running at more
I had to sneak that picture into a post. I loved transformers as a kid. Happy gaming!
No comments :
Post a Comment