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
3
Question by camtronius · Sep 11, 2014 at 03:10 PM · animationanimatorimporteventkeyframe

How to edit read only animations

Hello, I have been looking through numerous solutions to this problem and im not sure they meet my situation. I have an FBX blender model that has read only animations. I need to add keyframes/events to this animation to be able to call a function. My animations are contained within my model though, so if I try to duplicate the animation like other posts have said, it is not possible. I've heard that if you put the model in the scene, then make a prefab of that model, then it would work, but I already have a prefab based off this model... Does anyone have any experience with this situation? I have looked at this post already:

http://answers.unity3d.com/questions/187907/how-to-add-keyframes-on-imported-read-only-animati.html

if someone could offer a more detailed solution they used that would be awesome. 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

3 Replies

· Add your reply
  • Sort: 
avatar image
6

Answer by blorange · Sep 18, 2014 at 07:59 PM

I think I just worked this one out..

When Unity imports the FBX, the animation clip by default (at least on my Unity) is given a name like 'Anim|Cube'. You have to rename this in the import settings for the object, removing the | characters. Then after clicking apply, you can click on your clip in the project browser, press Ctrl-D and it should give you a copy outside the object.

Hope it works,

devDoug

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 DiegoMontania · Jun 06, 2018 at 06:19 PM 0
Share

Omg thanks work very well! Thank you!

avatar image
2

Answer by mchts · Apr 23, 2016 at 06:58 PM

I'm also using read-only animations. And I've also tried duplicating my animations and edit them manually. But it's troublesome. So i add my events to my animations at runtime once in Start(). For instance this is an event which calls a function with a float parameter:

 AnimationEvent animationEvent = new AnimationEvent();
 animationEvent.functionName = "your method name to be called"
 animationEvent.floatParameter = "single type parameter you want to pass"
 animationEvent.time = "time when to trigger event"
 Animation["state you wish to add event"].clip.AddEvent(animationEvent);

Then define your method in your script and it will be fired off as you described.

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 WILEz1975 · Jun 26, 2017 at 01:20 PM 0
Share

Good solution... but "Animation["state you wish to add event"].clip.AddEvent(animationEvent);" not work for me.

I modify your code:

 void AddEvent(int $$anonymous$$yClip, float time, string functionName, float floatParameter) {
     anim = GetComponent();
     AnimationEvent animationEvent = new AnimationEvent();
     animationEvent.functionName = functionName;
      animationEvent.floatParameter = floatParameter;
     animationEvent.time = time;
     AnimationClip clip = anim.runtimeAnimatorController.animationClips[$$anonymous$$yClip];
     clip.AddEvent(animationEvent); }





avatar image longmang · Dec 01, 2017 at 12:10 PM 0
Share

Thanks to all. This definitely set me on the right track. Adding events at runtime fixed it for me.

avatar image
1

Answer by WILEz1975 · Dec 02, 2017 at 07:36 AM

But beware, in the presence of multiple objects with the same animation, the event is added several times because the animation is always one for all the objects. You need to add a static variable that specifies that the event should only be added once.

     public static bool EventsAdded;
 
 
 
     void Start() {
         if (!EventsAdded)
         {
             AddEvent(13, 0.3f, "TriggerActive", 0); //my events
             AddEvent(13, 0.5f, "ShotFire", 0);
             AddEvent(14, 0.5f, "DeleteObject", 0);
 .....
             EventsAdded = true;
         }

This should only be done if there are more objects with that animation.

Or... you can add events following this: link

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

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

Related Questions

Animation events are still executing after transitions 1 Answer

changing a specific keyframe value 0 Answers

Manually Animating Bones then blending with existing animations or saving importing as fbx 3 Answers

2D Animation does not start 1 Answer

Unity Import automatically adds unnecessary Keyframes 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