日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

U3D中的又一个坑

發布時間:2025/3/18 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 U3D中的又一个坑 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

U3D中的又一個坑

1 using System.Collections; 2 using System.Collections.Generic; 3 using UnityEditor; 4 using UnityEngine; 5 6 public class animImport : AssetPostprocessor 7 { 8 9 //fbx動畫導入前的處理,對動畫集進行切分,轉成單個的動畫子集 10 void OnPreprocessAnimation() 11 { 12 var modelImporter = assetImporter as ModelImporter; 13 var anims = new ModelImporterClipAnimation[10]; 14 for (var i = 0; i < anims.Length; ++i) 15 { 16 anims[i] = new ModelImporterClipAnimation(); 17 anims[i].takeName = "hello-" + i; 18 anims[i].name = "hello-" + i; 19 } 20 21 //錯誤寫法 22 //這里的clipAnimations是個屬性,對它賦值時會調用它的set方法,該方法會檢測數組的每個元素,有一個為NULL就報錯,示例如下: 23 modelImporter.clipAnimations = new ModelImporterClipAnimation[10]; //有10個元素的數組,每個都是NULL,運行時報錯 24 25 //正確寫法 26 //modelImporter.clipAnimations =操作一旦執行,對clipAnimations中的任何元素的更改都不再起作用,必須在此操作前執行更改 27 modelImporter.clipAnimations = anims; 28 for (var i = 0; i < modelImporter.clipAnimations.Length; ++i) 29 { 30 //anims[i].name更改了,但modelImporter.clipAnimations[i].name沒更改, 31 //雖然語法上它們仍指向同一變量,應該是內部特殊處理 32 anims[i].name = "ani-" + i; 33 anims[i].takeName = "ani-" + i; 34 } 35 36 } 37 }

?

posted on 2018-01-16 14:58 時空觀察者9號 閱讀(...) 評論(...) 編輯 收藏

總結

以上是生活随笔為你收集整理的U3D中的又一个坑的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。