• 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
14
Question by kacyesp · Sep 07, 2014 at 07:31 AM · booleananimation events

Why don't animation events allow you to call functions that take a bool parameter?

According to the docs, "The parameter can be a float, string, int, object reference or an AnimationEvent object."

Is there a good reason behind this? My only thought is that setting bool parameters during an animation is meant to be done somewhere else, but if that is the case, then where?

Right now I have a function which gets called at the start of each animation as an animation event:

 private void SetInterruptableFlag( int interruptFlag )
 {
     character.CurrentActionIsInterruptable = interruptFlag != 0;
 }

I know it's trivial, but I feel like I should just be able to directly set the variable equal to the value of the passed in argument instead of making an extra != comparison.

Comment
Add comment · Show 5
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 DESTRUKTORR · Oct 11, 2014 at 04:28 PM 1
Share

I would honestly chalk it up to deadlines. I can't come up with a reasonable explanation for why they would ignore bool arguments, apart from the idea that the animation event system is not yet fully fleshed out.

avatar image AL_W · May 11, 2016 at 07:06 AM 0
Share

"+1" for me

Just today wanted to add a bool to my animation event.

Not allowed.

facepalm

avatar image bobmoff · Sep 13, 2016 at 10:42 PM 0
Share

ha ha, this is so silly that it doesnt work.

avatar image Bonfire-Boy · Sep 14, 2016 at 09:14 AM 3
Share

I take the point in the question, but it makes the current situation look worse than it is... a ternary operator isn't necessary there (just use interruptFlag!=0, it's already the bool that the ternary operator returns).

avatar image kacyesp Bonfire-Boy · Nov 15, 2016 at 03:14 PM 0
Share

You're super right lol I must have been tired. Can't believe I didn't realize that at the time. I edited the question to use the != comparison ins$$anonymous$$d of the ternary.

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



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

Animation Event Bool Function? 0 Answers

Saving 30 bools in an array possible? 2 Answers

Coroutines not waiting for yield waitforseconds to finish? 1 Answer

Yield Waitforseconds not working at all 3 Answers

help with call var from other script 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges