我用的是unity5.xunity3d animationn.time为什么不能用了

修复Unity从4.x升级到5.x后部分脚本的编译错误_百度经验
&&&&&&互联网修复Unity从4.x升级到5.x后部分脚本的编译错误听语音123456
百度经验:jingyan.baidu.com将Unity从4.x升级到5.x后,部分脚本编译时产生以下几种错误。1).UnityEngine.Mesh.GetTriangleStrip(int)' is obsolete:&2).UnityEngine.Mesh.SetTriangleStrip(int)' is obsolete:&3).Type 'UnityEngine.Component' does not support slicing.百度经验:jingyan.baidu.comUnity 5.3.17百度经验:jingyan.baidu.com1解决方法:将GetTriangleStrip函数改成GetTrianglesEND百度经验:jingyan.baidu.com1解决方法:将SetTriangleStrip函数改成SetTrianglesEND百度经验:jingyan.baidu.com1解决方法:将animation改成GetComponent.&Animation&()END经验内容仅供参考,如果您需解决具体问题(尤其法律、医学等领域),建议您详细咨询相关领域专业人士。作者声明:本篇经验系本人依照真实经历原创,未经许可,谢绝转载。投票(3)已投票(3)有得(0)我有疑问(0)◆◆说说为什么给这篇经验投票吧!我为什么投票...你还可以输入500字◆◆只有签约作者及以上等级才可发有得&你还可以输入1000字◆◆如对这篇经验有疑问,可反馈给作者,经验作者会尽力为您解决!你还可以输入500字相关经验00001热门杂志第1期你不知道的iPad技巧3724次分享第1期win7电脑那些事6566次分享第2期新人玩转百度经验1379次分享第1期Win8.1实用小技巧2635次分享第1期小白装大神1876次分享◆请扫描分享到朋友圈Access denied | www.readbag.com used Cloudflare to restrict access
Please enable cookies.
What happened?
The owner of this website (www.readbag.com) has banned your access based on your browser's signature (3fddf0-ua98).Shiny new animation features in Unity 5.0
, June 26, 2014
The animation team has been working hard to pull together an impressive feature set for Unity 5.0. Here’s a quick overview of the new animation features you can look forward to!
State Machine Behaviours
In Unity 5, you’ll be able to add StateMachineBehaviour scripts to your states, and receive the following callbacks when the states are played:
OnStateEnter
OnStateUpdate
OnStateExit
OnStateMove
You can have as many StateMachineBehaviours in your State as you like. So to add IK on State, or to do some custom logic, simply drag the StateMachineBehaviour script on to it.
Basically, anything that requires some kind of StateMachine logic in your game – with or without animation – can use this.
Another great thing about this feature is that you don’t need to have tons of
if(animator.GetCurrentAnimatorStateInfo(0).isName("Idle") )
if(animator.GetCurrentAnimatorStateInfo(0).isName("Idle") )&&&&DoStuff()
(which I’m sure you have plenty of in your code),
you can just use StateMachineBehaviours instead!
State Machine Transitions
State Machines are growing more and more complex, so we introduced the concept of State Machine Transitions to provide a higher level of abstraction over the StateMachine logic.
In Unity 5, we’ve added Entry and Exit nodes to StateMachines. There are used during State Machine Transitions.
When you transition to a StateMachine, the animation system will evaluate the Entry node and branch to the destination that its conditions meet.
Exit: When going to the Exit node, the animation system will look at the outgoing StateMachine transitions and branch to the proper destination.
Note that you can mix transitions: State-&State, State-&StateMachine, StateMachine-&StateMachine…
What’s more, we also revamped the UI for our tool so you can now re-order your parameters and layers.
Asset Creation API
In Unity 5 you can cre StateMachines, States, Controllers, Layers, Blentrees, etc., using scripts in the Editor!
There are two APIs, a high-level one, where the assets are managed by Unity and a low level one where you manage assets manually, and can perform external referencing.
Both APIs are documented, and I’ve put a small example of API usage at the end of this post.
Direct Blend Trees
We’ve added a new type of BlendTree that allows you to map an animator parameter to the weight of a BlendTree child directly.
This can come in really handy if you’re working with BlendShape animations, or additive animations.
Root Motion Authoring (in generic mode)
Unity 5 also allows you to animate objects and convert their animator to root motion (ie Delta Animation). Simply create an animation – translation/rotation – on the topmost transform of an object then click Generate Root Motion Curve in the AnimationClip inspector!
More stuff that will make your life easier:
Improved animation previewer camera. The camera can now Pan, Orbit and Scale in the same way as the scene viewer.
Runtime access to parameters (name, default values etc..)
Gizmo in scene view for root position, ik position, etc…
Improved retargeting engine
Runtime optimizations
Tons and tons of bug fixes
Let us know what you think of these changes!
The Animation Team.
Asset Creation API sample Code
// Creates the controller
var controller = UnityEditor.Animations.AnimatorController.CreateAnimatorControllerAtPath ("Assets/Mecanim/StateMachineTransitions.controller");
// Add parameters
controller.AddParameter(“TransitionNow”, UnityEditor.Animations.AnimatorControllerParameterType.Trigger);
controller.AddParameter(“Reset”, UnityEditor.Animations.AnimatorControllerParameterType.Trigger);
controller.AddParameter(“GotoB1″, UnityEditor.Animations.AnimatorControllerParameterType.Trigger);
controller.AddParameter(“GotoC”, UnityEditor.Animations.AnimatorControllerParameterType.Trigger);
// Add StateMachines
var rootStateMachine = controller.layers[0].stateM
var stateMachineA = rootStateMachine.AddStateMachine(“smA”);
var stateMachineB = rootStateMachine.AddStateMachine(“smB”);
var stateMachineC = stateMachineB.AddStateMachine(“smC”);
// Add States
var stateA1 = stateMachineA.AddState(“stateA1″);
var stateB1 = stateMachineB.AddState(“stateB1″);
var stateB2 = stateMachineB.AddState(“stateB2″);
stateMachineC.AddState(“stateC1″);
var stateC2 = stateMachineC.AddState(“stateC2″); // don’t add an entry transition, should entry to state by default
// Add Transitions
var exitTransition = stateA1.AddExitTransition();
exitTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.If, 0, “TransitionNow”);
exitTransition.duration = 0;
var resetTransition = stateMachineA.AddAnyStateTransition(stateA1);
resetTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.If, 0, “Reset”);
resetTransition.duration = 0;
var transitionB1 = stateMachineB.AddEntryTransition(stateB1);
transitionB1.AddCondition(UnityEditor.Animations.AnimatorConditionMode.If, 0, “GotoB1″);
stateMachineB.AddEntryTransition(stateB2);
stateMachineC.defaultState = stateC2;
var exitTransitionC2 = stateC2.AddExitTransition();
exitTransitionC2.AddCondition(UnityEditor.Animations.AnimatorConditionMode.If, 0, “TransitionNow”);
exitTransitionC2.duration = 0;
var stateMachineTransition = rootStateMachine.AddStateMachineTransition(stateMachineA, stateMachineC);
stateMachineTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.If, 0, “GotoC”);
rootStateMachine.AddStateMachineTransition(stateMachineA, stateMachineB);
123456789101112131415161718192021222324252627282930313233343536373839404142
// Creates the controllervar controller = UnityEditor.Animations.AnimatorController.CreateAnimatorControllerAtPath ("Assets/Mecanim/StateMachineTransitions.controller");&// Add parameterscontroller.AddParameter(“TransitionNow”, UnityEditor.Animations.AnimatorControllerParameterType.Trigger);controller.AddParameter(“Reset”, UnityEditor.Animations.AnimatorControllerParameterType.Trigger);controller.AddParameter(“GotoB1″, UnityEditor.Animations.AnimatorControllerParameterType.Trigger);controller.AddParameter(“GotoC”, UnityEditor.Animations.AnimatorControllerParameterType.Trigger);&// Add StateMachinesvar rootStateMachine = controller.layers[0].stateMachine;var stateMachineA = rootStateMachine.AddStateMachine(“smA”);var stateMachineB = rootStateMachine.AddStateMachine(“smB”);var stateMachineC = stateMachineB.AddStateMachine(“smC”);&// Add Statesvar stateA1 = stateMachineA.AddState(“stateA1″);var stateB1 = stateMachineB.AddState(“stateB1″);var stateB2 = stateMachineB.AddState(“stateB2″);stateMachineC.AddState(“stateC1″);var stateC2 = stateMachineC.AddState(“stateC2″); // don’t add an entry transition, should entry to state by default&// Add Transitionsvar exitTransition = stateA1.AddExitTransition();exitTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.If, 0, “TransitionNow”);exitTransition.duration = 0;&var resetTransition = stateMachineA.AddAnyStateTransition(stateA1);resetTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.If, 0, “Reset”);resetTransition.duration = 0;&var transitionB1 = stateMachineB.AddEntryTransition(stateB1);transitionB1.AddCondition(UnityEditor.Animations.AnimatorConditionMode.If, 0, “GotoB1″);stateMachineB.AddEntryTransition(stateB2);stateMachineC.defaultState = stateC2;var exitTransitionC2 = stateC2.AddExitTransition();exitTransitionC2.AddCondition(UnityEditor.Animations.AnimatorConditionMode.If, 0, “TransitionNow”);exitTransitionC2.duration = 0;&var stateMachineTransition = rootStateMachine.AddStateMachineTransition(stateMachineA, stateMachineC);stateMachineTransition.AddCondition(UnityEditor.Animations.AnimatorConditionMode.If, 0, “GotoC”);rootStateMachine.AddStateMachineTransition(stateMachineA, stateMachineB);
Related posts
February 8, 2018o
November 28, 2017o
December 13, 2016o
December 13, 2016o
November 29, 2016o
October 11, 2016o
59 Comments
jordans retro
The next time I read a blog, I hope that it doesnt disappoint me as a lot as this 1. I mean, I know it was my option to read, but I basically thought youd have something fascinating to say. All I hear is usually a bunch of whining about some thing which you could fix when you werent too busy seeking for attention.
jordans retro
Categories
Popular posts
February 2, 2018
January 31, 2018
January 30, 2018
February 5, 2018
February 7, 2018
February 12, 2018我用的是unity5.x
animation.time为什么不能用了【unity3d吧】_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:83,888贴子:
想判断animation.time + 0.1f &animation.length
火星学习unity3d,编程师就业薪资20k起,毕业=高薪就业,unity3d0基础学习,半年即可入职一线游戏/互联网公司,火星终身免费推荐就业.
[Obsolete (&Property animation has been deprecated. Use GetComponent&Animation&() instead. (UnityUpgradable)&, true)]以前是:animation.GetClip(name)现在是:GetComponent&Animation& ().GetClip(name)
最好判断这个动画剪辑是否在播放比较好
登录百度帐号}

我要回帖

更多关于 unity animation 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信