I've created a huge city - 36 km2. You can test it here - http://allunity3d.com/scene/146/
But my application takes too much memory ~ 1.5 Gb. Which way of optimization can I try, to reduce allocated memory?
At the moment I create all visible objects on the application start.
Tough to say without knowing what this city entails exactly. I Can't check out your link right now, I'll try and check it out tomorrow. I'll try and give some general pointers that might help...
A few places to start looking would be:
- The meshes. High poly meshes will take much more memory. Usually in a scenario like a city you would try to make simple box meshes. To make it not look flat and boring, the difference between buildings would be in the textures. Which brings me to:
- The textures. VERY important... Make sure your textures are compressed, and use the smallest sizes possible. If you're not going to ever get close to a certain building - there's probably no need to use 4096x4096 textures on it. Also - if you don't need the alpha channel - don't use formats that keep it (DXT5, RGB32 etc...)
- Build a standalone player of your game. It will make sure your textures are compressed as set in their import settings. By default this is done only when building, and not on import. After the build process is complete look at the Editor log (it's easily accessible using a button on the top-right corner of the console window). After a successful build it will display a list of your assets with their sizes from largest to smallest. Now, this is size on disk - not in memory, but it will give you some indication on where to start your efforts.
Depending on what game you're trying to create - you might need to split up your scene into several tiles (usually done using AssetBundles in Unity) that will load and unload on demand based on proximity to them or something of that kind. Google "Open world games" to read up about it if you're not sure what I mean. Unity is fully loaded to handle that scenario.
Try and give some more details about your project. It's hard to help without knowing what you are trying to do with that city and how it's constructed.