We are attempting to replicate the our existing game functionality with mecanim and have the following use case.
We have a character customization system where all meshes and animations are saved in separate asset bundles. ( similar to the unity character customization demo). Currently our system allows us dynamically load in new animations which then can be applied to the characters. Mecanim allows the saving of animations and animation controllers to asset bundles. However, in our test, when loading a character with an animation controller from the asset bundle, we get the message “Cannot show controller from asset bundle”. From further tests, it also seems that we cannot stream animations into the game, we have to embed all animations in the animation controller.
Mecanim is “The Default Animation” system for unity going forward. Asset bundles is a Pro feature for those who want a streaming game. Currently mecanim only supports a subset of the Streaming functionality offered to Pro users. Would it possible for Mecanim to provide the streaming functionality that’s been so useful in the old animation system.
I asked last year if you were able to dynamically load animations (api access to mecanim) and create your animations/blends on the fly and was told that this type of functionality is not available.
@UnLogick: Asset Bundles do work in unity 4.1 - meaning that we can save a prefab of character with its animation controller in an asset bundle and then load this asset bundle back into the game. The problem is that once it’s loaded into the game, we do not have access to it via CODE. The legacy animation system allows us to have much more control. For instance, we want to be able to save a bunch of animations on the server and then be able to load these animations dynamically to use with the character. Basically it’s like the character customization demo where the user can change clothing and body parts. We want to be able to dynamically change the animations in-game.
@ddesmond: I believe that you are probably correct that we definitely need API access. Unity could make this be a PRO feature. We bought the PRO version and Mecanim is not giving us much more than the basic unity version.
@Rocki: right, now I understand what you’re trying to do. It is still not possible to create/edit the state machines at run-time and I still can’t say when it will be ready. But I do know that the Mecanim runtime API have been split into parts and you should expect to see avatar creation before you see state-machine creation. As usual the new functionality will be shipped when ready.
Great that you understand what we need to do. It’s so hard to explain using words. I would like to ask about what you wrote. “Mecanim runtime API have been split into parts and you should expect to see avatar creation before you see state-machine creation”. I don’t totally understand what you mean by “avatar creation” in terms of mecanim. Can you elaborate.
In short it will be possible to create a skinned mesh at run-time and hook it up as a Mecanim humanoid. This is very useful if you want to character customization to actually have an impact on how the animations are played. Details will be announced when the feature is ready.
At the moment, the character customization demo breaks the character into separate skin meshes and these skin meshes are then reassembled in the game engine with its mecanim animation controller.
If I understand you correctly, do you mean that the new feature will allow us to create a skinned mesh in-game and then characterized it in-game as a humanoid. Does it also allow us to apply any Animation Controller to the character ?
That would be the general idea. How could you use a Mecanim Humanoid without a Controller? I do believe that is already working. I’m not sure you’re allowed to change the Controller whenever you feel like it, but you should at least be allowed to make an initial assignment.
You’re right, the humanoid definitely needs the controller, but the the question is whether it this assignment can be for ANY controller. Any Controller gives Unity PRO users the features that they paid for. Dynamic loading of assets and animations.
The old animation system that’s being removed honored the Unity PRO contract by allowing us to save animations on the server that can be dynamically loaded into the game and applied to the character. Mecanim at the moment has taken away the features of PRO and Reverted us to the Basic Unity version. We are locked out of being able to load animations dynamically.
Overall, Mecanim is such a great system and vast improvement over the old system in many ways and because Mecanim will be the Default animation system moving forward, please make sure that it gives PRO users what they Paid for.
I strongly agree with rocki on this, the lack of dynamic loading is very limiting. The only option I have is the old animation system to create my game.
I’m afraid I don’t understand what you mean. The message “Cannot show controller from asset bundle” refers to the fact that a controller in an AssetBundle is a compiled asset that cannot be visualized inside Unity, but it can still be used at run-time to power your animations.
Unless I’m missing something all you need to do is take your Controller from the asset bundle and link it to the Animator component on the Character and it will play the animations?
Loading the Controller from the Asset Bundle and have it powering the character is not the problem. The problem is that we cannot access the contents of the Controller with code. The Controller’s API is not exposed to coders and really limits what we can do.
For example:
Replace the animation in the Idle state with another animation that is stored on the server.
Create/Remove animation states via code.
Instead of using Controller A for this character, we can use Controller B on the server.
Ideally, what can be done in the Editor should at least also be done using code.
The Controller’s visual interface is successful in streamlining the animation workflow within the Editor. What is missing is to expose the controller API so that coders are able to do at least as much as the Old System was able to provide.
We have a different use case but we also have the need to dynamically load animations into controller.
We have a huge amount of custom animations around the levels and want to handle this by only having the core locomotion set in the actors controller and then on the fly load animation states/networks, attach them to controller and then blend to it.
That the controller has to contain every animation that a character potentially can play is very limiting, both for memory optimization but also for production pipeline
@UnLogick: It definitely takes time so that Mecanim can fully replace the old animation system. A request is to start matching the old animation at the Unity PRO level because these are the customers who have paid the most to use Unity.
@mogensh: Yes, this is also exactly our situation. We have a large number of animations - too many to hard-code into the game. Additionally, we are publishing to Webplayer, Flash and mobile devices.
We also need to modify the animation controller. We need to setup a controller for one animal (not using humanoid features) but then swap all the clips to another animal. Seems pretty simple, but not possible right now. There’s 100+ animals so there’s no way we’re manually setting up a controller for each.
I will rebump this thread but I think it’s not implemented yet ?
My goal is to have for example 4 characters and a huge amount of animation done by my graphist and that could be bind on all my characters.
I have 2 solutions :
First : Change dynamically each motion clip of each state when my application start (but I think it’s actually not possible)
Second : Generate a controller with all transition between state with the good clip when my game start (But I think it’s not possible too ?)
I don’t want to create them before because it could be really long and painful to maintain for my graphist/level designer. And sometimes with a particular character I will need to change only one clip of one particular state cause his animation could be different from the other :(.
Someone have a solution to this problem of runtime state edition ?
Maybe I must use the legacy system ;( but sadly Mecanim is really useful for a lotof thing actually.
If you want to attach another mecanim controller at runtime that has different animations associated with it then there is a hack workaround found in my customisation workshop 2 using mecanim found at www.digitech-innovations.com
However, this does not allow different animations to be associated to the controller via api when its being used at runtime.