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
0
Question by Daphoeno · Feb 15, 2014 at 05:59 PM · animatorissueunity 4.3

New animator system issues (unity 4.3)

I'm having major problems working with the new animator system in unity 4.3 and wanted to know if anyone could give a quick bit of information on how I could do this:

I have created animations for the shaking of the camera as the player is walking and sprinting. At the moment when I click play the animation plays automatically and I can't seem to stop it. I tried to create a basic script to control the animations, as I would have done in previous versions of unity. Unfortunately, I kept receiving errors saying that there were no animations attached to the object (camera).

Here's the script I made:

 #pragma strict
 
 function Update () 
 {
     if(Input.GetKeyDown(KeyCode.W)){
         animation.Play("walkingAnimation");
     } else if(Input.GetKeyDown(KeyCode.W) && Input.GetKeyDown(KeyCode.LeftShift)){
         animation.Play("sprintingAnimation");
     }
     
     if(Input.GetKeyUp(KeyCode.W)){
         animation.Stop("walkingAnimation");
         animation.Stop("sprintingAnimation");
     }
 }

Image of camera's (game object to animate) animation setup:

alt text

I would appreciate any help that you may have and if you would like more information on my problem, feel free to ask.

animation problems.png (25.0 kB)
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
2
Best Answer

Answer by tanoshimi · Feb 16, 2014 at 07:45 AM

The "new" Animat*or component uses a totally different architecture to the previous Animation* component. You don't directly play animation clips - you associate animation clips with states in a simple Finite State Machine, with defined transitions between the states. You then transition through the states from code by calling, e.g.

 Animator.SetBool("Sprinting", true);

I suggest you watch the introductory videos here: http://unity3d.com/learn/tutorials/modules/beginner/animation

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 Daphoeno · Feb 27, 2014 at 11:30 PM 0
Share

Thank you for this answer! The videos really helped and my project is back on the rails

avatar image
0

Answer by MakeCodeNow · Feb 15, 2014 at 06:05 PM

It's confusing, but you need to use "animator." not "animation." The animation property refers to the old pre-MechAnim system, while animator refers to the new system. If you replace animation with animator and then update your code to use the new animator logic, I think you'll be ok. Alternatively, add an Animation component and not an Animator component to your game object.

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 Daphoeno · Feb 15, 2014 at 06:08 PM 0
Share

When removing the animator component it made no difference and by replacing "animation" with "animator" I had unknown identifier errors for it.

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

20 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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Disable Root Motion in legacy humonoid animation 1 Answer

How do you add a mesh to a LOD Level in Code? 0 Answers

How do I check, and change, the current frame/time of a sprite animation in Unity 4.3? 0 Answers

Car Wheels Error/Glitch/BUG, Please help. 1 Answer


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