Recently updated a batch of bone animation resources, do not see, a look at a fright, the previously optimized out of the content will need to be re-processed again, so. Now let's take the previous stuff out and make a note.
Fortunately, the animation has been dynamically loaded, now only need to re-remove the excess information (FBX uses the import settings is legacy| Store in Root (New), and then the animated message is copied out in a separate way), mainly for the following two points:
1) The scale information of skeletal animation is basically useless
2) The float storage accuracy of each bone point information does not require very high precision (except for some animations, depending on the performance effect)
There was a first attempt to manually remove the test effect, but for unity's own reasons, will cause the manual modified Anim file to grow a lot (suspected unity bug) (using the UNITY5.5.2F1 version), the direct use of the program to clean the way it does not have this problem, first directly on the original code:
usingSystem.Collections;usingSystem.Collections.Generic;usingUnityengine;usingUnityeditor; Public classBoneanimoptimizetool {[MenuItem ("window/animationtool/optimize Boneanim")] Public Static voidOptimizeanim () {varTobjarr =selection.gameobjects; foreach(varObjinchTobjarr) {Removeanimationcurve (obj); } } //Remove Scale Public Static voidRemoveanimationcurve (Gameobject _obj) {List<AnimationClip> tanimationcliplist =NewList<animationclip>(Animationutility.getanimationclips (_obj)); if(Tanimationcliplist.count = =0) {animationclip[] tobjectlist= UnityEngine.Object.FindObjectsOfType (typeof(Animationclip)) asanimationclip[]; Tanimationcliplist.addrange (tobjectlist); }foreach(Animationclip Animclipinchtanimationcliplist) {foreach(Editorcurvebinding curvebindinginchanimationutility.getcurvebindings (Animclip)) {stringTname =CurveBinding.propertyName.ToLower (); if(Tname.contains (" Scale") {animationutility.seteditorcurve (Animclip, curvebinding,NULL); }} compressanimationclip (Animclip); }}//Compression Accuracy Public Static voidCompressanimationclip (Animationclip _clip) {animationclipcurvedata[] Tcurvearr=animationutility.getallcurves (_clip); Keyframe TKey; Keyframe[] Tkeyframearr; for(inti =0; i < tcurvearr.length; ++i) {animationclipcurvedata tcurvedata=Tcurvearr[i]; if(Tcurvedata.curve = =NULL|| TCurveData.curve.keys = =NULL) { Continue; } Tkeyframearr=TCurveData.curve.keys; for(intj =0; J < Tkeyframearr.length; J + +) {TKey=Tkeyframearr[j]; Tkey.value=float. Parse (TKey.value.ToString ("f3"));//#.###Tkey.intangent =float. Parse (TKey.inTangent.ToString ("f3")); Tkey.outtangent=float. Parse (TKey.outTangent.ToString ("f3")); TKEYFRAMEARR[J]=TKey; } TCurveData.curve.keys=Tkeyframearr; _clip. Setcurve (Tcurvedata.path, Tcurvedata.type, Tcurvedata.propertyname, Tcurvedata.curve); } }}
For the convenience of each update, the ANIM resource can be automated and can be extended to monitor animation resources and then automate the process.
Unity's Animation animation resource compression