Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
4
Question by VesuvianPrime · Aug 02, 2014 at 01:00 PM · editorvector3animationcurvefield

Does Unity provide a Vector3 Curve similar to AnimationCurve?

Hey guys

So far my usage of AnimationCurves has been limited to animating single float values (for example, controlling the alpha of a color over time).

Now I'm in a situation where I want to use animation curves to animate things like the scale of an object:

alt text

alt text

As you can see I'm using 1 AnimationCurve for each axis. My question is: am I reinventing the wheel? Does Unity already provide a Vector3 AnimationCurve set?

If Unity does not provide this I would like to move towards making my own Editor classes to present these curves in a nicer way. I have noticed that Shuriken has it's own curve fields:

alt text

Somehow Shuriken is drawing a custom field for the curves, and is also drawing a custom curve editor.

How would I go about drawing curves like this to the inspector? How does shuriken make the extra editor window appear at the bottom of the inspector? How could I write a custom curve editor to show my 3 curves at the same time?

Comment
Add comment · Show 3
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 Ash-Blue · Dec 27, 2014 at 12:44 PM 0
Share

Any solutions for this? Some kind of way to use Shuriken's built-in-graph-system could really change a ton for data driven aspects of my game.

avatar image RudyTheDev · Dec 27, 2014 at 01:08 PM 0
Share

Curve editor support multiple curves at a time, but there's no easy way to get it to work from code. You'd need reflection to get and open CurveEditorWindow, get its internal CurveEditor, then set its m_AnimationCurves and probably a dozen other values that Unity normally automates.

avatar image VesuvianPrime · Dec 27, 2014 at 01:27 PM 0
Share

I ended up writing my own PropertyAttribute and PropertyDrawer to display the curves in the inspector, and then exactly as $$anonymous$$TheDev says: use reflection to pop open the curve editor.

Unfortunately the CurveEditorWindow only supports one curve at a time. It's frustrating, because reading the code in .NET Reflector it looks like Unity would only need trivial changes to unlock this functionality.

2 Replies

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

Answer by VesuvianPrime · Aug 19, 2015 at 02:15 PM

My curves PropertyAttribute:

https://bitbucket.org/thisishydra/hydracommon/src/master/Scripts/PropertyAttributes/Vector3CurvesAttribute.cs

The drawer:

https://bitbucket.org/thisishydra/hydracommon/src/master/Scripts/Editor/Drawers/Vector3CurvesDrawer.cs

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 a436t4ataf · Sep 09, 2018 at 04:34 PM 0
Share

The linked files won't work - they have a tonne of dependencies you need to track down from the project, would be better if you'd linked to the ZIP file to download the whole project perhaps?

Also: you've put a copyright + license on this preventing people from shipping it in their project - this is a nightmare if you ever want to share code, make an asset-store version of your code, etc - so it's not really an appropriate answer to the question (digging in the project, the stated license is currently LGPL, so I guess we could re-write it as an actual library, compile it, package it into a DLL, and then ship it with an asset-store package? But IANAL and this is a rabbit hole :)).

On the plus side, the code looks clean (apart from the long dependency chain).

avatar image
0

Answer by wolilio · Sep 29, 2020 at 09:51 AM

you can create a AnimationClip with scale,and then use https://docs.unity3d.com/ScriptReference/AnimationClip.SampleAnimation.html to get scale over time

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

27 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

Need help with editor script to copy animation data into individual curves 1 Answer

Editor scripting, select a field 1 Answer

Animationcurve Tangets Smoothing 1 Answer

Issues with AnimationCurves 0 Answers

SerializeField does not work when a value set using code 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