Unity3d usage experience (2): Unity3d dynamic download of animation resources-Use of AnimationClip

Source: Internet
Author: User

Introduction:

When using Unity3d to develop micro-ends or web games, you often need to package resources into AssetBundle, and then dynamically download resources through www. Today I want to share some detours and my final solutions when I download the Animation. There are hundreds of sets of animation resources in our project. Each set of animation is about KB to kb, so an important requirement is to download the required animation dynamically.

Incorrect method:

The first method that comes to mind after I see the requirement is to instantiate the Prefab imported into FBX, save the Animation as an Asset file through ScriptObject, and then export it as an AssetBundle file. When the game is running, assign the downloaded Animation component to the Animation variable of the corresponding GameObject. The tragedy is that I found that the Animation accessors are read-only at this time.

Correct practice:

Export all the AnimationClip objects in Animation to be added to ScriptObject as arrays, save them as Asset files, and export them as AssetBundle files. When the game is running, add the downloaded Clip object to the Animation component to complete the dynamic loading of the Animation.

AnimationClip contains Animation data, which can be flexibly added or deleted from Animation.

Another seemingly feasible method:

Import the Prefab game object imported into Fbx and export the Texture of Mesh (grid data) and Shader in SkinnedMeshRenderer component into AssetBundle, the remaining gameobjects that have deleted the two data are combined with the animation to form a Prefab, Which is dynamically assembled during running. If this method is used to dynamically download role Resources in the project, you can bypass the problems encountered in the previous article to a certain extent. However, the previous solution is a more accurate solution to the problem.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.