• 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 avidesk · May 09, 2013 at 02:59 PM · editorinspectoranimationcurve

Custom Inspector - Accessing AnimationCurve

I'm trying to add some functionality to the inspector when using AnimationCurves. I'm having trouble accessing the AnimationCurve itself so I can eventually modify it. I get the error that Unity.Object cannot be converted to AnimationCurve. I don't get this error if my editor script targets one of my custom scripts, only if I target a unity class.

If I add buttons to this script, it applies them to every public AnimationCurve variable in my project, which is exactly what I want, but since I can't actually access the animationcurve to make changes to it, its not doing me any good.

 [CustomEditor(typeof(AnimationCurve))]
 public class ExtendedCurves : Editor
 {
     private AnimationCurve thisCurve;
 
     public void OnEnable()
     {
         thisCurve = (AnimationCurve)target;
     }
 
 }
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 Banksy · May 11, 2013 at 01:01 PM 0
Share

I am also interested in gaining access to AnimationCurves that I created .. I do not see them in the inspector ? I tried also opening the Animation window... but nothing :(

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by andrew-lukasik · Mar 10, 2017 at 10:39 AM

CustomEditors are usually written for Monobehaviour scripts and won't work with AnimationCurve type since it inherits only from System.Object (from what I can tell).

I suspect that the thing you're really looking for is an attribute called CustomPropertyDrawer. If that is the case then make this ExtendedCurves class a typical wrapper inheriting from nothing and write CustomPropertyDrawer for it. ExtendedCurves in this scenario can contain and extend AnimationCurve's functionality easily without conflicts.

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.

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

15 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

Related Questions

Inspector editable animation curves (without animation curve class please) 2 Answers

Inspector Popup format to look like tag or layer popup 1 Answer

Make popup window in inspector if deleting GameObject 0 Answers

How could I merge 2 components' inspectors through a custom editor? 2 Answers

How can I override the default inspector editor with my own? 3 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