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 DaveStoops · Aug 16, 2013 at 10:02 AM · animationarrays

Animation sets via array lookup

Hi everyone,

I am looking at using animations which are stored within an array, so for example, I have a game which requires the user to select a set of actions for their moves, these are stored within an array, then the avatar cycles through each animation one after the other.

Is there a way to achieve this easily? It needs to be as dynamic as possible to allow a player to continually add actions to the list.

Any guidance would be greatly appreciated.

Comment
Add comment · Show 1
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 yogee · Aug 16, 2013 at 10:22 AM 0
Share

will u put a sample code

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by TonyLi · Aug 16, 2013 at 01:54 PM

In Legacy, your avatar will have an Animation component. Use AddClip to add clips to the component and RemoveClip to remove them. Call Play() or CrossFade() to play them, and check IsPlaying to know when they're done so you can remove them if you want.

In Mecanim, it's currently difficult to add and remove animations at run-time. You should probably create a Animator Controller (state machine) containing all the possible states, and use parameters to transition between them.

Comment
Add comment · Show 2 · 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 DaveStoops · Aug 17, 2013 at 12:58 PM 0
Share

Thanks for the advice on this, I am still using the legacy version so it sounds straight forward to put together.

I will be looking at moving towards using meca$$anonymous$$ going forwards after I build the proof of concept. The animation sets are around 100 variations, so it would be a challenge to use a state machine build

avatar image TonyLi · Aug 17, 2013 at 05:11 PM 0
Share

Good luck on it. When you move to $$anonymous$$ecanim, it shouldn't be too bad. As a simple pass, you could drag all your animations into the state machine and have a single int parameter that transitions to them from Any State.

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

17 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

Related Questions

Animation position changes everytime I play the animation 1 Answer

Can I make animations snap to a frame? 1 Answer

Animation in UNITY problem, Animation keeps moving out of position 0 Answers

Mecanim: change the animation even though it is not finish in playing 2 Answers

How to Move the rotated Game Object Forward 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