Hello,
I’m currently experiencing some very vexing animation issues. Animations I have set up will play fine in the editor, but on the device behave inconsistently. Weirdness like animations not playing all the way through, or not playing at all, have been cropping up.
To give an example, I have an animation fbx exported from Maya that consists of little people and cars moving around. In the scene, it’s placed in such a way that they look like they’re boarding a ferry which is docked (basically they move so they’re inside the ferry mesh and obscured from view, and then sink down out of sight below the water). The animation component has this boarding animation set as the default, and the wrap mode is set to Once. To fire off the animation, I’m doing a simple animation.Play() command. In the editor, it works fine. The animation plays all the way through, and the people cars move down out of sight after boarding. When the ferry moves off, they’re out of the way and can’t be seen.
When run on a device, however, the animations seem to not play all the way through sometimes. I’ve had instances where the ferry has departed, and the cars and people are still clumped together where the ferry was, rather than sitting below the water where they’re not visible.
Another thing has to do with animations I have placed on the ships themselves, though it’s more involved and I suspect I’m doing something incorrectly. Basically what I’m trying to accomplish is:
A ship moves into a dock from offscreen. When it docks, a player loads it with cargo. While loading, the ship plays an animation of cargo appearing on its deck, and it gets lower in the water. At any time during this process, the player can choose to send the ship back out. If the ship is still loading cargo, it should stop its loading animation where it is, so it will show a partial load of cargo on deck and only partially be lowered in the water, and then animate back off screen. The ship should then reset to its original idle state having no cargo and being high in the water, because it is used again to represent a new ship pulling into the dock.
The ship object I have set up is an fbx from Maya that I split into two clips, based on animations the 3d artist created. The first two frames of its animation are an “idle” animation, which consists of the ship sitting high in the water. The rest of the animation frames are the ship’s “fill” animation, which shows the ship loading cargo and lowering. I have animation states defined for these two clips in my code, and their wrap modes set to Once.
When I bring a ship into dock, I do the following:
shipAnim.Play("idle");
to make sure the ship is in its idle state. When a player starts loading cargo onto the ship, I start the fill animation:
shipAnim.Play("fill");
If the player lets the ship load all the way, the animation reaches its endpoint and stops, with the ship showing as fully loaded and low in the water. If the player sends the ship out prematurely, I call:
shipAnim.shipAnim.Stop();
to stop the animation where it is.
In the editor, this all works fine. The ships come in empty, they dutifully load cargo and stop midway if sent out early, and they leave the screen and come back in empty as a new ship. However, on the device I run into all sorts of weirdness. Ships will come in however full they were when they left, and sometimes the “fill” animation will only play halfway and stop.
Has anyone else run into things like this?