Http://www.cnblogs.com/dosomething/archive/2012/04/07/2436353.html
3d game in a scene is often larger if the game needs to download a 10M or even a larger scene when loading the time will lead to the loss of a large number of players
We know that the built-in terrain in Unity3d is necessary to load a scene with a height map, load the terrain first, and display the parts in the scene again (such as trees, houses, etc.).
Loading parts in a scene can be loaded from near to far depending on where the player is currently located
Each part in the scene is not really unique.
Like an identical tree, which may appear in many places in the same scene. It's just the location of the tree.
Then loading the scene only requires loading a tree model and recording the transform information of n trees will greatly reduce the space occupied by the scene.
If the reuse rate of the model is high then the problem will be solved to reduce the space occupied by a scene exponentially.
When loading, the scene only needs to download a model of a tree and copy n trees at the specified location according to the transform information.
You need to traverse the scene file under the selected folder before packaging with Unity3d Buildpipeline
If the Meshfilter mesh for the file appears only once in the folder, then the model does not repeat in the scene, the transform information of the model file is recorded and packaged
If the mesh appears more times than once, the transform information for these and the same model of the mesh is recorded, including a model and multiple transform information when packaged
In Unity3d, there is a class called Scriptableobject that can use it to store the various resources that it needs.
public class Transformholder:scriptableobject
{
public int Length;
public vector3[] position;
Public quaternion[] Eulerangles;
Public vector3[] Localscale;
}
In this way, each resource bundle contains a model and a file of type Transformholder
A length of Transformholder of 1 indicates that the model appears only once in the scene
More than 1 can generate multiple transform based on the recorded information loop.
There were hundreds of scenarios with a resource pack size of more than 10 trillion
After this method has become more than 20 resource pack size reduced to less than 2M
Of course, this applies to the phenomenon that the model in the scene is reused.
"Unity3d" 3d web game scene packaging and loading