Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 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
2
Question by Kalbytron · Jan 24, 2014 at 07:09 AM · editorfunction

Animation Event won't show the function I need

I'm trying to add a function to fire on a certain frame, but the function I need will not show up in the edit animation event window. How do I fix this?

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

6 Replies

· Add your reply
  • Sort: 
avatar image
8

Answer by GearKlik · Mar 21, 2018 at 09:17 PM

Old question but I worked this out, if you select an animation clip in the Project explorer and try and edit an event's properties it wont show a list of available functions.

However If you select an object in your scene graph with an Animator component then bring the Animation window and select your clip in the dropdown it will show a list of functions you can call. It makes sense because Unity won't know which functions it can call just by editing the animation clip asset, it needs the context of the game object that's playing it.

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 mcroswell · Oct 01, 2018 at 08:37 AM 0
Share

Thanks.

This is one of those things that if you don't do often, even if you know it, you may forget.

I'm really glad you posted your answer!

avatar image
2

Answer by JCX · Jan 24, 2014 at 07:49 PM

animation event calls public methods of other components attached to gameObject playing the animation

so basically make component (monobehaviour class) AnimationEventListener and make public method like

 public void EventHandlerMethod()
 {
 // the code you need
 }

attach it to the gameObject in scene and it should appear in the dropdown menu of AnimationEvent keyframe

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 Kalbytron · Jan 24, 2014 at 08:15 PM 0
Share

Ok, but the animation event window only shows functions from the parent gameobject. How do I make it show the functions of the child gameobjects?

avatar image JCX · Jan 25, 2014 at 02:30 AM 0
Share

i'm not sure you can do that, but for sure you can call them from the parent component

http://docs.unity3d.com/Documentation/ScriptReference/Component.GetComponentInChildren.html

avatar image
2

Answer by kentmw · Nov 07, 2016 at 10:37 PM

Check out this answer: http://answers.unity3d.com/questions/786404/why-dont-animation-events-allow-you-to-call-functi.html

If you have a boolean parameter, it doesn't show

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
1

Answer by Danief_ · Nov 15, 2019 at 03:00 AM

For anybody else who lands here, the animator can only call methods with a single parameter. If you have several parameters, it won't appear on the list. You have to pass a parameter of type AnimationEvent . Here are more details: https://answers.unity.com/questions/11159/one-parameter-limit-on-animation-event-functions-t.html

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
1

Answer by SamuelKeller · Jan 08 at 07:39 PM

Old question, but another issue that might cause this is attaching the script to a child of the object holding the animator, the script must be attached to the parent object for the function to show.

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
  • 1
  • 2
  • ›

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

26 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

Related Questions

Is there any way to call OnLevelLoaded when loading a scene in editor? 2 Answers

Animation Event - "Function not supported" 2 Answers

Better way to call function from another script from editor script? 1 Answer

Changes in variables from function triggered by editor script during edit mode are not applied. 2 Answers

Using draggable actions in Editor 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