Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
This question was closed Jun 04, 2016 at 10:25 AM by 3Duaun.
avatar image
0
Question by 3Duaun · Jun 18, 2011 at 03:21 PM · runtimeanimationclip

Add animation clip at runtime

I've read over many "answers" to the question, but none have worked for me thus far. So pardon the possible redundancy, and I appreciate any help that can be offered:

I'd like to take a specific set of animation-clips from the assets folder, imported automatically while importing an FBX, and assign them to a mesh at runtime(during the "Start" or "Awake" call in a script), to be triggered later via code. All this works, so far, as long as the clips are attached to the mesh in the editor BEFORE runtime. Though, ideally, I'd rather assign only specific clips at start/awake, than assign more animation clips than are needed(in the editor beforehand) for a specific scenario(say for a specific weapon that is equipped on a character, calling for only a specific set of animations).

This is key: these animations would ideally NOT be assigned specifically beforehand in the editor. I have no issues with playing/triggering these animations if they are already attached to the mesh's animation component via the editor before runtime, but I want to assign only specific animation clips at runtime(during start/awake), without relying on having all of them attached beforehand via the editor.

I've tried calling the names of the clips explicitly as strings, doing AddClip, GetClip, etc, and a tons of other methods, nothing has worked thus far. Would I need to go the assetBundle route, or use the resources folder, or a different direction?

Is this possible? If so I appreciate any insight that can be offered. Thank you :-)

P.S. I've heard that adding anim clips at runtime can be taxing on mobile devices, if anyone can offer insight into any tests in that situation, I'd appreciate it. Thanks again.

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 3Duaun · Jun 18, 2011 at 05:03 PM 0
Share

http://forum.unity3d.com/threads/58371-Adding-animation-clips-from-a-loaded-resource

http://forum.unity3d.com/threads/30089-Load-animation-from-Resource-folder

I just found those 2 links that answered my main question, with code to boot :-)

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by sneftel · Jun 18, 2011 at 04:56 PM

The resources folder would probably work. It's really the only way to load assets that aren't referenced from the scene. You could also have the full array of animation clips in some MonoBehavior in some hidden manager object, and draw from that... I think that would work.

But why bother? Animation clips on an object that aren't being played don't slow things down or anything.

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 3Duaun · Jun 18, 2011 at 05:02 PM 0
Share

thanks for the answer. I'm under the impression that anim clips occupy system memory(precious on mobile devices), and we're trying to reduce the memory footprint any way we can. The resources(or assetbuldle) route looks like a way to do just that.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Export objects to a .3DS file at runtime 1 Answer

How can I get a split clip's fbx parent name? 0 Answers

[Solved]AnimationClip.SetCurve error 1 Answer

Load .fbx from remote http server at runtime to use it as animation clip at runtime 0 Answers

Change AnimationClip's sprites 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