Unity AnimatorController注意事项
发布时间
阅读量:
阅读量
通过 assetbundle 加载的独立打包 AnimatorController 采用下述方式赋予值
Go. GetComponent(an).runningAnimationController = (RuntimeAnimationController) obj;
通过Resouce.load 加载的AnimatorController使用
通过调用Instantiator获取一个新实例Go Componentabcdefghijklmnop().runtimeAnimatorController = (Runtime Animator Controller)使用Instantiator方法生成新的实例
根本原因在于Resource的实际加载情况并不理想,在采用Bundle方式时,虽然部分资源被加载进来。
推测该Resource导入时未配置引用计数
IEnumerator Download(string url)
{
WWW www = new WWW(url);
yield return www;
if (www.isDone)
{
if (!string.IsNullOrEmpty(www.error))
{
Debug.LogError(www.error);
yield return true;
}
Object obj = [url=http://www.assetBundle.mainAsset]www.assetBundle.mainAsset[/url];
if (obj != null)
{
m_npc.GetComponent<Animator>().runtimeAnimatorController = (RuntimeAnimatorController)RuntimeAnimatorController.Instantiate(obj);
}
}
}
代码解释
全部评论 (0)
还没有任何评论哟~
