I am working on a game with a large, dynamically generated terrain. The method uses many identical instances of a simple square geometry to create the terrain. As the rectangles change VERY quickly, I would rather not create new gameobjects for each and every one of these squares, as it is comparatively slow against directly calling the renderer API with the mesh and the correct transformation matrix.
I don't have Unity Pro, so I can't use the GL library. My question is whether I can use the MeshRenderer to render the same object into a different position, without creating a new object.
asked May 20 '12 at 11:47 PM
No, the MeshRenderer is a component. So it's responsible to render the attached mesh at the gameobjects position. The GL class actually works in the free version (but since the docs states it's pro only it can change at any time). Also the GL class isn't suited for your task. There is the Graphics class but this is unfortunately truly pro only ;)
However depending on your needs it's propably better to pack all those squares into one mesh and adjust the vertices manually.
Keep in mind that Unity has a hardlimit of 64k vertices which means you can only have a limited count of quads in one Mesh so you might need to split your terrain into chunks.