Introduction:
In the use of unity3d development of micro-end, or web games often need to package resources into Assetbundle, and then through the way of the WWW dynamic download resources. What I want to share today is a few detours and my final solution when I download the Animation skeleton animation dynamically. There are hundreds of animation resources in our project, each set of animation about 300KB to 900KB before, so there is a very important requirement is the dynamic download required animation.
the wrong way:
The first way I saw the demand was to instantiate the Prefab that the FBX was poured into, save the Animation through ScriptObject as a asset file, and then export it to a assetbundle file. When the game is running, the downloaded Animation component is assigned to the corresponding Gameobject Animation variable. The tragedy was that I found Animation accessors to be read-only at this time.
the right approach:
All Animationclip objects in the export Animation are added as arrays to ScriptObject, saved as asset files, and exported as assetbundle files. When the game is running, add the downloaded clip object to the animation component to complete the animated dynamic loading.
The animationclip contains the animated data and can be flexibly added to the delete from the animation.
Another seemingly viable approach:
the Prefab-instantiated game object that the FBX is poured into,--skinnedmeshrenderer the mesh (grid data) in the component, and Texture in Shader, respectively, into Assetbun Dle, the remaining gameobject of the two data will be deleted together with the animation into a prefab, the dynamic assembly when running. If the way in which the role resources are dynamically downloaded in the project is this way, you can somewhat circumvent the problems encountered in the previous article. However, the former solution is a solution to the problem in a more accurate way.