This is a similar question to the one posted here:
http://forum.unity3d.com/viewtopic.php?t=47409&highlight=animation+events+standalone
But as an answer from Unity was never given, I am bringing it back up again in hopes of getting a response if possible.
Basically, I have narrowed down what seems to be a weird bug in Unity Standalone Mac builds. I have several animations which rely on Animation Events to do certain things in my game. For example, I have an animation event which fires during a “sheath sword” animation which turns off the sword mesh’s renderer at the correct time.
These events function just fine in Windows standalone builds, and while playing the game in the editor (and I am using the editor on a Mac). However, Mac standalone builds seem to be passing “0” to all the animation event functions, even though that is not what I have told them to pass in the Edit Animation GUI.
Is this a known bug? Or is there something I’m missing?
I’m getting ready to try and perform a workaround by passing an Animation Event Object which contains a float instead of just passing a float directly to see if maybe this bug is limited to animation events that pass floats…but I’m not holding out much hope.
Thanks,
RD
Okay, so surprisingly, using the AnimationEvent workaround did work.
So here’s what I did. I went and changed all of the functions where I wanted a float to accept an AnimationEvent object instead. Then I just got the float value from the AnimationEvent object.
For example, the function previously might have been:
function combo_step(step: float) {
// Do something based on step
}
And is now:
function combo_step(ae: AnimationEvent) {
var step: float = ae.floatParameter;
//Do something based on step.
}
It wasn’t too much trouble to make the change, and luckily the Unity Editor was smart and after I changed each function to AnimationEvent, it kept the previous “float” value in the “float” field in the Animation Editor GUI.
Still, glad I caught this early on, as it would be a huge pain to go back and update lots of code later.
I can only assume that this is, indeed, a bug.
Thanks,
RD
Please can you file a bug report for this (menu: Help > Report A Problem). There are a few bugs associated with animation events, but I’m not sure this particular one has been reported before.
ahh, yes. I can verify this bug. However I found it in the Web Version on Mac. Animation Event work correctly in the editor and on the PC, but not on the Mac stand alone or Mac web client.
The animation events have never worked correctly. Hopefully the next revision will have gone through enough bug fixing passes to be usable.
I’ll file a bug report as well.
G–
Any one still experiencing the bug discussed in this thread?
When creating an animation event that passes a float value to a method, the method always receives a 0. This only happen on Mac Stand Alone and Web Builds. The Mac editor version works fine.
This is a Mac only problem. The web and stand alone builds work fine on PC.
I’m trying to put together an example for untiy, but I completely ripped all use of this code out of all of my projects. I just don’t have a good example on hand. anyone else have a good example to share with Unity support?
This bug doesn’t seem to have been fixed yet but is scheduled to be fixed in v3.2. The case number is 372112 and the bug was actually submitted by someone with “megaton” in their e-mail address - is it possible that this is one of your colleages or just a coincidence?
We never got a repro case on this. (There was no project attached to bug report 372112 and it couldn’t be reproduced from the description alone.) Somebody needs to make a simple project that reproduces the issue and send it with a bug report. We can’t fix the issue when we can’t reproduce it.