Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by oliver-jones · Mar 03, 2014 at 12:38 PM · animationguianimator

Animation Vs Animator

Are Unity replacing the animation system with the animator? Because every time I make a new animation, it builds it through the Animator now. Which seems too complex for my type of animation.

When I say animation, I mean a simple quad animation that has a script attached to it for event calls within specific key frames. I'm using this for a 3D scene GUI element. So theres no avatar, or humanoid involved.

If this is the case, then how do I control the animator player now? Before, for the animation, I would go animation.Stop, or animation.Play.

This doesn't work for the animator. I took a look at the script reference, and I found this:

Animator.StopPlayback

But that doesn't actually seem to do anything.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Dizmiester · Mar 03, 2014 at 01:09 PM

Setting animator variables or parameters. Then in the Animator you set the state changes in relation to those variables and in your script you modify those variables.

Say you want a walk jog and run animation, then you would set a groundSpeed parameter.

In the Animator set a state for walk, jog and run and set the relation to if(groundSpeed > 0 && groundSpeed < maxWalkSpeed ) loop the walk animation and the same for jog and run etc.

Make sure you set parameters for an idle animation.

update the groundSpeed parameter from your velocity calculations and the animator should change the state according to the value of groundSpeed.

You can also just play states from your code using (where anim is a variable of type : Animator, and set to the Animator component) anim.Play("theNameOfYourState");

Note: Animator.Play() will throw up an error because you are saying "the Class of Animator".Play() rather than referencing an instance of the Animator class (ie: the Animator component attached to your GObject)

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image oliver-jones · Mar 03, 2014 at 01:54 PM 2
Share

Okay, but isn't this system a bit of an over kill if your doing, for example an animation for a 3D GUI? Where it needs to be controlled by script, but also only needs to use the simple animation transforms.

avatar image oliver-jones · Mar 03, 2014 at 02:45 PM 0
Share

I cant get my head around this, I've made a full animation clip within the Animation window. I've also added event key frames that call functions within the attached script.

Firstly, I don't wont to play the entire animation (the whole animation contain different states of my 3D scene GUI).

What I would normally do is place an event key frame at the end of one state within the animation, and within that function, have animation.Stop();. But this was with the old animation system, which I cant use for this new Animator. So I tried anim.StopPlayback(); (to prevent it continuing through the rest of the animation), but nothing happens (although it is calling the function as it prints).

avatar image Dizmiester · Mar 04, 2014 at 10:35 AM 0
Share

Ok I see, you could try setting the animations as Legacy in the inspector. That would then allow you to control them as you did before. Not 100% sure on GUI animations. This may mean you don'tuse the Animator at all but make the animations in blender or such.

avatar image Tsilliev · Jun 14, 2015 at 10:13 AM 0
Share

I still dont get it, you can put your animations in the animation component, and then just call them in your script: If(Pressed$$anonymous$$ey"W" && !pressedkey(leftshift)) { animation.play"walk" } if(pressedkeyW&≤ftshift) { animation.play"run" } simple as that as I can see, why do I need to go to the animator, make variables, point to states etc etc etc if I can just say, push button play this and thats it, simple as possible.

$$anonymous$$y understanding is that the animator is a GUI designer, so you can see do it graphically ins$$anonymous$$d of typing and making a script.

avatar image
0

Answer by Triqy · Mar 05, 2014 at 01:47 AM

I think you have to set up the animator as a generic type when setting up your animator. Then your have to split your key frames up on your objects and set them up individually in the inspector. Like 0-30 walk, 31-61 run/ whatever. The in your script that you have on your object would be something like animator.Play("walk"); or animator.Play("run");

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image muratrishit · Aug 07, 2014 at 12:13 PM 0
Share

////// help help public AnimationClip animclip;

animator.animation.AddClip(animclip,"runmm");

alt text

aa.jpg (197.0 kB)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

22 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Animations - Can you cut them? 2 Answers

How do I add NPCs? 2 Answers

2D Animation does not start 1 Answer

Problem with GUI animation transitioning. 1 Answer

GUI button is moving/disappearing when animation is played 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges