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
2
Question by mcwind · Mar 30, 2011 at 03:10 PM · runtimeanimationcurve

How to access AnimationCurve at runtime

Unity introduced AnimationCurve as a runtime class. But there is no doc or any sample on accessing it while the game is running. I'll be greatful if someone can to me how to do. Thanks.

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

4 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Statement · Mar 31, 2011 at 12:21 PM

You can't get AnimationCurves from an AnimationClip. Strangely/sadly you can only set or add curves.

You'll have to keep track of any curves you create procedurally, in a dictionary for instance.

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 mcwind · Apr 07, 2011 at 03:00 PM 0
Share

Yes, now I saved the AnimationClipCurveData to disk and created a curve at runtime with it.

avatar image
2

Answer by Statement · Mar 30, 2011 at 03:19 PM

What way do you intend to use it?

Here's an example usage for animating a light turn on through Evaluate. You edit the AnimationCurve in the inspector. You can also give it some simple default value through Linear and EaseInOut.

var intensity : AnimationCurve;

yield AnimateIntensity();

function AnimateIntensity() {
var duration = intensity[intensity.length - 1].time; var timer = 0.0f; while (timer < duration) { timer = Mathf.MoveTowards(timer, duration, Time.deltaTime); light.intensity = intensity.Evaluate(timer); yield; } }

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 mcwind · Mar 31, 2011 at 03:09 AM 0
Share

I can process the curves in a editor script to meet my requirement. I just intend to know more about the class. It's a runtime class but can't be accessed at runtime, very strange.

avatar image mcwind · Mar 31, 2011 at 03:14 AM 0
Share

I mean "Access" as obtaining it from a clip at runtime, not just assigning it in inspector as a static reference.

avatar image
0

Answer by Varaughe · Oct 12, 2013 at 08:11 AM

If you want to edit at runtime an animation curve,check this out:
http://u3d.as/content/rus-artur-pfa/runtime-curve-editor (new version available ! )

Comment
Add comment · 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
0

Answer by $$anonymous$$ · Nov 15, 2016 at 10:51 AM

 AnimationCurve curveX = AnimationUtility.GetEditorCurve(ac, "Bip01", typeof(Transform), "m_LocalPosition.x");

it's ok in editor mode.

Comment
Add comment · 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

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

1 Person is following this question.

avatar image

Related Questions

How to modify animation curve in run time? 2 Answers

reimporting at runtime? 0 Answers

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

AnimationCurve created in runtime, unexpected behaviour 2 Answers

Modifying an entire animation with a single animation curve? 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