• 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 affreuxgeorges · Dec 13, 2013 at 12:11 PM · animation2d

Object Reference Keyframe ???

Hi there !

My question is adressed to unity devs, if they could answer a little question ;) but if anybody here has an idea, of course, or more information to share, i would be glad to hear.

I discovered recently a hidden-undocumented- struct called ObjectReferenceKeyframe, which can be used to define objectReference curves in a clip via AnimationUtility.SetObjectReferenceCurve();

It seems to be used in the sprite renderer internally to handle sprite property animation.

What I would like to know, as the animation curves documentation now say you can animate these "objectreference" properties, is : what are the conditions to use this new feature?

  • can I animate custom ScriptableObject classes?

  • should the scriptableobjects in these keyframes be saved to disk as .assets in order to use them in clips?

So, I would like to know if this feature has been restricted to sprites only and for spriterenderer binding only, or is this usable with custom classes on other components? And, if so, if there is a plan to release the full feature in the next months?

To be clear, i'm designing a custom 2D framework to fit my specific needs in a sidescroller platformer development, and I have to say I love the way unity handle sprite animation. The question is can I replicate this behaviour with my custom sprite assets, or should I find a workaround?

Thanks Pierre.

Comment
Add comment · Show 2
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 Caspilar · Dec 15, 2013 at 04:14 PM 0
Share

I have been struggling with the new 2D framework and found this new $$anonymous$$eyframe too. I was also developing my own Skeletal Animation plugin to work with some 3rd party tools. Here's the post in unity forum that I wrote (there's a code snippet too).

http://forum.unity3d.com/threads/212615-Lack-of-scripting-functionality-for-creating-2D-animation-clips-by-code

In the code snippet, you have to at some point define the property name and the type of the EditorCurveBinding (required to create the ObjectReference$$anonymous$$eyframes):

 // I want to change the sprites of the sprite renderer, so I put the typeof(SpriteRenderer) as the binding type.
 
 curveBinding.type = typeof(SpriteRenderer);
 
 // Regular path to the gameobject that will be changed (empty string means root)
 
 curveBinding.path = "";
 
 // This is the property name to change the sprite of a sprite renderer
 
 curveBinding.propertyName = "m_Sprite";

I guess that this could be done for any other property and type, but I have not tested it. The "m_Sprite" is the one required to change the sprite itself. If you test it, please let me know the results!

avatar image affreuxgeorges · Dec 16, 2013 at 03:04 PM 0
Share

Yeah, thanks for sharing. actually I tried it out with some custom class property, and the drag n drop in dopesheet didn't work for custom type properties. Worse, if property is Sprite and component isn't spriteRenderer, the drag and drop will automatically create a sprite renderer on your gameobject and animate its sprite property. seems the unity guys did something rough for sprites and didn't planned to release the full functionnality.

I have to try animating my custom properties via script only and see if something happen this time.

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

18 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

Related Questions

2D Animation does not start 1 Answer

2d sprite animation issue 2 Answers

Zombie Cafe style game. 1 Answer

Make 2d Animation Scene 0 Answers

Making transform based animation "snap" when mixing with sprite based animation 2 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