- Home /
Hiding Private Functions From AnimationEvents
When I create an AnimationEvent, I expect the available function list that shows up to only contain public functions that match the requirements. This works, but it also shows all of the private functions in my class that match. I want to be able and hide those from the list. Is there anyway to tell Unity to not show a function in the Event list drop down?
It's funny though. I've bumped into this thread, because I've had exactly the opposite question. I'd expect animation events to fire only private functions to hide all the internal animation rubbish under the hood.
Saw this thread as I was thinking that the function name drop down was getting out of hand and that there were no tags (HideInInspector does not work either) neither do protected/private affect whether the function shows. It's rather cluttered when you have a # of monobehaviors on the same level as the animator.
I think there is more appropriate solution - "HideInAnimationAttribute" to explicitly mark unwanted methods from showing in animation as possible event. And to think further, it should be possible to apply this attribute per method or per class basis to achieve total control.
Answer by MagyarPeter · Mar 28, 2021 at 12:48 PM
Use internal variables. "internal int Test = 1;//this variable will not show up in the animation event list"
But there is another problem: how to use interfaces in this situation? I have to set all of my Interface variables to public, otherwise the interface will not see them. (my interface needs more than 50 public variables, and its flooding the animation event list)
Your answer
Follow this Question
Related Questions
How to add new curves or animation events to an imported animation? 6 Answers
Can one Animation Event be used for a timespan (multiple frames)? 1 Answer
Player lose damage when enemy is attacking (animation) 1 Answer
AnimationEvent triggers twice 3 Answers
Transform Of GameObject getting changed incorrectly after updating RuntimeAnimatorController 0 Answers