Search Unity

Mesh Animator - Highly efficient animated crowds. For support, please use email.

Discussion in 'Assets and Asset Store' started by jschieck, Dec 7, 2014.

  1. JonDadley

    JonDadley

    Joined:
    Sep 2, 2013
    Posts:
    139
    Fantastic news! looking forward to seeing the results :)
     
  2. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Great news guys! Mesh Animator supports GPU Instancing out of the box in the current version! All you need to do is create the appropriate shader and material (follow these steps http://docs.unity3d.com/Manual/GPUInstancing.html)



    Any meshes that are displaying the same frame of animation, for example idle_frame20 will automatically be instanced. Remember you need to be using DirectX 11+.

    So for crowds it's probably a good idea to have a bunch of crowd members animations synced up throughout the crowd, then they'll all be batched into a single draw call! Happy to answer any questions if you're having issues getting this to work. Cheers!
     
    JBR-games and hopeful like this.
  3. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    It seems GPU instancing actually slows down performance in your comparison shot?
     
  4. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Well that comparison was done using a mobile diffuse shader vs. the instanced standard shader and in the editor so the other stats aren't really comparable. I've tested it in builds and am able to get 5k crowd members at 60fps with both no problem, and the more instances you add the better performance you'd start to see out of GPU instancing.
     
    LudiKha and one_one like this.
  5. FlaxSycle

    FlaxSycle

    Joined:
    Oct 6, 2012
    Posts:
    232
    So I recently stumbled across Mesh Animator, and while it's mostly been very easy and intuitive to use, I ran into an issue with bounds

    mesh_animation_bounds.jpg

    This particular animation moves away from its starting point (it starts below the origin and climbs up) and any mesh outside a certain region is smeared to infinity. I played with compression and bounds extents on the original skinned mesh renderer but it didn't seem to affect the result.

    Is there a way to override or boost the bounds?
     
  6. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Hmm that's interesting, could you possibly send me the source mesh and I'll take a closer look for you?
     
  7. FlaxSycle

    FlaxSycle

    Joined:
    Oct 6, 2012
    Posts:
    232
    I went ahead and made a simple testcase (I wanted to confirm it wasn't any of my assets causing the issue) so here it is with a looping teapot animation.

    [EDITED TO REMOVE ATTACHMENT: DO NOT PUBLICLY POST ASSETS FROM THE STORE]
     

    Attached Files:

    Last edited by a moderator: Aug 3, 2016
  8. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    PM'd you a fix.

    Everyone else,
    The new version has also been submitted to the asset store and is awaiting approval. I've also decided to stop supporting Unity 4.x versions, and only from 5.0+ from here on out. If you have a project still in Unity 4.x and have an issue, I'll work with you personally to get it fixed and possibly get you a back-ported version.
     
  9. duencil

    duencil

    Joined:
    Dec 17, 2012
    Posts:
    91
    Hey, trying this out for the first time to help with an audience scene. I'm trying with free crowd models from https://www.assetstore.unity3d.com/en/#!/content/8563

    We have several problems, and have seen none of them mentioned so I dont know if we are following a correct workflow. When dragging the Audience prefab onto the generation window, the Skinned Mesh 0 field gets populated with "Audience (Clone) (Skinned Mesh Renderer)". After generating the animations and dragging the newly created "Audience_AnimatedMesh" onto the scene, i get the following problems
    • the prefabs were using a scale and a rotation. The newly dragged in mesh displays tiny and unrotated until entering play. This we can live with, and understand since the scale and rotation are being baked into the animation
    • At runtime, in the location we dragged the object into in the scene, we get a huge non-animated mesh in its place. Instead at what appears to be world position 0,0,0 we see an animated copy, with the name "Audience(Clone)". This newly instantiated object persists in the scene even after play stops.
    Should the correct workflow be to use objects in the scene instead of prefabs? Or is it something about the crowd models we use that is throwing this?
     
  10. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    You should be able to use either a prefab or object in the scene. I'll download the asset your trying to convert and get back to you shortly.
     
  11. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    I didn't realize that's the actual asset I use in the crowd demo! Yeah you should be able to just use the prefab in the prefabs folders and create the mesh animated object with that. The other prefabs are just different assigned materials. So once the one mesh animated asset is created, create different version of that prefab with the different textures assigned.



     
  12. duencil

    duencil

    Joined:
    Dec 17, 2012
    Posts:
    91
    Yes I realized afterwards too that you had a demo with one of these same characters. For some reason when I select Create MeshAnimator from the prefab, it populates the Skinned Mesh 0 field with "Audience (Clone) (Skinned Mesh Renderer)" which it isnt doing on your animated gif

    I'm using Unity 5.4 P1 if thats any help.

    Edit: I just reimported those audience assets, and it works without the clone issue. Not sure what I did to break it originally. It still has issues with rotation though, but these are less important. Thanks
     
    Last edited: Aug 20, 2016
  13. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    This looks terrific -- but how does it transition from mesh animations to the rigged model as the player approaches? (We need a seamless transition so the player can move into the crowd and interact with individual NPCs.)
     
  14. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    You can use Unity's built in LOD system for this. The higher LOD levels would be using a Mesh Animator object, and the closest LOD would use just a normal SkinnedMeshRenderer. Have a look at this post I made where I have it setup.

    http://forum.unity3d.com/goto/post?id=2644793#post-2644793

     
  15. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Great asset! Really improve performance!
    But i think you should improve mecanim sync, because it has really poor performance. Animator.Update costs a lot! It would be nice if you can create Mesh Animator animation sequence like in Animator Controller and just play it in series.
    Somehow Play() doesn't work for me
    On GO with Mesh Animator i have this
    Code (csharp):
    1.  
    2. public class PlayAnimationsInLoop : MonoBehaviour {
    3.  
    4.     public MeshAnimator meshAnimator;
    5.     // Use this for initialization
    6.     void Start () {
    7.         meshAnimator = GetComponent<MeshAnimator>();
    8.         meshAnimator.eventReciever = gameObject;
    9.         meshAnimator.Play(meshAnimator.defaultAnimation.name);
    10.     }
    11. }
    12.  
     
    Last edited: Oct 25, 2016
  16. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Hey, glad you like it! Yes Animator.Update can be very slow with lots of animators. If all you're looking to do is loop through several animations, you can do something like this, and it'll be much more efficient.

    Code (csharp):
    1.  
    2. public class PlayAnimationsInLoop : MonoBehaviour {
    3.  
    4.     public MeshAnimator meshAnimator;
    5.     public string[] animationsToLoop;
    6.  
    7.     private int currentIndex = 0;
    8.  
    9.     void Start()
    10.     {
    11.         meshAnimator = GetComponent<MeshAnimator>();
    12.         meshAnimator.eventReciever = gameObject;
    13.         meshAnimator.OnAnimationFinished += OnAnimationFinished;
    14.         meshAnimator.Play(animationsToLoop[currentIndex]);
    15.     }
    16.     void OnAnimationFinished(string animationName)
    17.     {
    18.         currentIndex++;  
    19.         if(currentIndex >= animationsToLoop.Length)
    20.             currentIndex = 0;
    21.         meshAnimator.Play(animationsToLoop[currentIndex]);
    22.     }
    23. }
    24.  
     
  17. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    I did the same, but for me Play() didn't work. But it is not necessary, i used auto play.
    In mecanim mode, OnAnimationFinished doesn't inviking cause in MeshAnimator.cs string
    Code (csharp):
    1. currentFrame >= cAnim.frames.Length
    counting frames wrong. (currentFrame never reaches Anim.frames.Length, it's always less).

    I played with this asset last 4 hours and have some tips to newcomer users
    1)Oprimize MeshAnimator.cs
    • Find crossFadeMesh.RecalculateNormals() string and comment it , nothing happens, but it steal some FPS.
    • Find crossFadePositions = Vector3.Lerp(crossFadeFrame, frame, cFadeDelta); and replace it with crossFadePositions = frame; It also helps save some fps.
      [*]Second tip will help you avoid calling GC Collect method, which invoking performance pick reducing(~ 10ms for 500 instances). I have 1 parent object for all crowd instances. Make in this object script which will be containe random values. It just can has one var public List<float> randomNumbers;
      [*]In MeshAnimator.cs go to OnEnable() and make some kind of this
      Code (csharp):
      1.  
      2. allRandomNumbers = GetComponentInParent<AllRandomNumbers>();        
      3.         float randomDelay = UnityEngine.Random.RandomRange(0f, 5f);
      4.         while (allRandomNumbers.randomNumbers.Contains(randomDelay))
      5.         {
      6.             randomDelay = UnityEngine.Random.RandomRange(0f, 5f); ;
      7.         }
      8.         allRandomNumbers.randomNumbers.Add(randomDelay);StartCoroutine(DelayedStart(randomDelay));
      .

      [*]Make coroutin that delayed starts OnEnable code.
      Code (csharp):
      1.  
      2. yield return new WaitForSeconds(delay);
      3.         mTransform = transform;
      4.         float timePerFrame = 1f / FPS;
      5.         InvokeRepeating("UpdateFrameInvoked", 0.001f, timePerFrame);
      6.         if (resetOnEnable && meshFilter)
      7.         {
      8.             if (playAutomatically) Play(defaultAnimation.name);
      9.             else isPaused = true;
      10.             if (currentAnimation != null)
      11.             {
      12.                 currentAnimation.GenerateFrameIfNeeded(baseMesh, currentFrame);
      13.                 currentAnimation.DisplayFrame(meshFilter, currentFrame, -1);
      14.             }
      15.         }

      [*]If you are using Animator, make 1 controller(in parent object) for crowd group, that also helps avoid GC Collect.
      [*]You need to avoid creating vars in LateUpdate method! animatorStateInfo - it's the one stateInfo in parent for all childrens, this helps avoid Animator.Update() cost in every instance. In MecanimMeshAnimatorController.cs LateUpdate it can be like
      Code (csharp):
      1.  
      2. id = animatorStateInfo.thisStateInfo.fullPathHash;
      3.  
      4.             if (animHashes.ContainsKey(id))
      5.             {
      6.                 if (cAnim != animHashes[id])
      7.                 {
      8.                     cAnim = animHashes[id];
      9.                     if (crossFade)
      10.                         meshAnimator.Crossfade(animHashes[id]);
      11.                     else
      12.                         meshAnimator.Play(animHashes[id]);
      13.                 }
      14.             }

     
    hopeful likes this.
  18. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    Some models after preparing lose their orientation. Others that uses same animations do not
     
  19. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    This has to do with the orientation of the root bone in the FBX. It should animate correctly, just look rotated when not animating. If not, could you send me the model so I can take a look and get it fixed?
     
  20. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    There's a bug in your compression code that causes the size to be calculated incorrectly. In Mesh Frame Data, the code at line 138 checks the extent of the vertex, increasing the size of the bounds by 10x if it's greater than that position. However, I have a death animation that causes the character to fall backwards, which fails this check since the values are negative. This cases the verts to smear out to either short.MaxValue or int.MaxValue. Wrapping each check in an Abs() fixes the issue:

    for (int i = 0; i < frames.Length; i++)
    {
    for (int j = 0; j < frames.verts.Length; j++)
    {
    if (indexRemaps.ContainsKey(frames.verts[j]) == false)
    {
    indexRemaps.Add(frames.verts[j], allPositions.Count);
    allPositions.Add(frames.verts[j]);
    while (Mathf.Abs(frames.verts[j].x) > sizeOffset)
    sizeOffset *= 10;
    while (Mathf.Abs(frames.verts[j].y) > sizeOffset)
    sizeOffset *= 10;
    while (Mathf.Abs(frames.verts[j].z) > sizeOffset)
    sizeOffset *= 10;
    }
    output.frameIndexes[i * output.vertLength + j] = indexRemaps[frames.verts[j]];
    }
    output.rootPosition = frames.rootPosition;
    }
     
    ZJP likes this.
  21. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Awesome, thanks for letting me know!
     
  22. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Anytime!
     
  23. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    Hello jschieck,

    You said above that since version 1.4.7 root motion can be baked into a mesh animation. However, I don't see any mention of that in the docs, nor do I see anything related to that in the GUI. And when I tried baking an animation with root motion in it, it didn't work out of the box. With root motion, I expect the game object itself to move according to the root motion. However, with the mesh animation, the game object stayed still - only the vertices were animated with the root motion included. Which is what I'd expect when root motion is completely ignored.

    I'm not using a humanoid model, in case that matters.

    Edit: I just checked the code and it looks like it's humanoid only.
     
    Last edited: Nov 25, 2016
  24. JonDadley

    JonDadley

    Joined:
    Sep 2, 2013
    Posts:
    139
    @jschieck are you considering doing anything with the Graphics.DrawMeshInstanced() API added in Unity 5.5? I did some tests with it earlier and it took a scene with 20,000 cubes that was using an instanced shader from < 20fps to a rock-solid 90fps. Pretty powerful, could potentially add a nice perf boost to Mesh Animator in certain circumstances.
     
  25. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Yeah currently it only bakes the movement into the animation. I've got plans for this capability in the future however.

    Not yet, but I'll definitely look into it!

    Also I've just pushed Version 1.4.9.2 to the store, so once approved it'll have these improvements:
    • Humanoid rigs properly show the controller slot even if they don't have any animations.
    • Humanoid rig animation clips are now automatically populated once the controller is placed.
    • Custom state names and multiple layers now work in the animation controller for humanoid rigs. They no longer need to match the animation clip name.
    • Fixed prefab links being broken when rebaking.
     
    Last edited: Nov 29, 2016
  26. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    A few tweeks I'd like to see to the workflow:

    - When you have a 0 frame animation in Unity, this comes out as a 1 second animation in MeshAnimator instead of a single frame animation
    - When updating the file, the converter creates a new object. This causes the GUID in the meta file to get changed, and any components on the object to be lost since it's a new object. It would be really nice if the converter checked to see if the file exists and just recreated it's components on that asset instead of creating a new one.
     
  27. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Thanks for the bug reports!

    1) I'll look into this and fix it in the next update.
    2) This is fixed in the latest version 1.4.9.3 (currently awaiting approval in the asset store). PM me if you need it right away.
     
  28. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    Hello jschieck,

    First of all, we really appreciate the performance gains MeshAnimator has given us, rendering hundreds of different characters at once!

    But am I missing something, or does the "speed" variable on the MeshAnimator component only support interger values and 1 / interger fractions? (That is, ... 1/5, 1/4, 1/3, 1/2, 1, 2, 3, 4, 5 ...) I tried playing my animation (baked and played back at 30FPS, no LOD levels set up) at speeds 1, 1.1, and 2, and while 1 and 2 were clearly different, 1.1 seemed to be exactly as fast as 2.

    Looking at the UpdateFrameInvoked function seems to support this. If the speed is under 1, it seems to just skip frames until the appropriate time has passed (without compensating if too much time passes). If the speed is over 1, it'll just skip ahead by multiple frames at a time, every update.

    I understand this might be sufficient for many people's needs, but this makes MeshAnimator very difficult for us to use. We'd like the MeshAnimator animations to behave as closely to the originals as possible, as we'd like to switch between them as the LOD changes. And we also need to dynamically change the speed all the time as the characters walk around at different speeds.

    I suspect I might need to rewrite that function, but wanted to check with you first. Thanks in advance for any response!
     
  29. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Hey! Thanks for your report! I've fixed the problem and PM'd you the updated script, also it's fixed in version 1.4.9.4 which is currently in review in the asset store.

     
  30. TommiH

    TommiH

    Joined:
    Jan 14, 2008
    Posts:
    253
    Hello again jschieck and thanks for the help so far!

    I have another issue related to a response you gave earlier:

    I've tried exactly this: Mecanim at LOD level 0 and MeshAnimator at higher LOD levels, using Unity's LODGroup to switch between them. However, I'm worried that running all the animations at all times would be unnecessarily expensive, so I'm playing only the ones that are visible. However, LODGroup doesn't give any information about what LOD level is currently visible - the only way to check is to check "isVisible" on the renderers themselves. But that flag is only updated at render time, when the object is already being drawn, so I can only start the animation one frame too late. And in case of MeshAnimator, there might be a couple of extra frames before the InvokeRepeating gets called again too.

    Any thoughts on this? I know it's not 100% a MeshAnimator issue. But it's my understanding that if I was using only Mecanim + LODGroup, I would be able to have only one Animator running animations and then one SkinnedMeshRenderer on each LOD level.

    Edit: I'll probably just write my own distance-based check to replace LODGroup, but I'd still be interested to read your thoughts.
     
    Last edited: Dec 9, 2016
  31. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Have you tried using OnBecameVisible and OnBecameInvisible? I'm not sure if that will get fired early enough to sync up the animations or not, but it's worth a shot.
    https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnBecameVisible.html
    https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnBecameInvisible.html
     
  32. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    424
    MeshAnimator.cs line 398 couses a lot of garbage(in case of big amount of Mesh Animators in the scene).
    Instead of
    Code (csharp):
    1. crossFadePositions = new Vector3[crossFadeFrame.Length];
    2. Array.Copy(crossFadeFrame, crossFadePositions, crossFadeFrame.Length);
    i am initialized crossFadePositions at Awake()
    Code (csharp):
    1. crossFadePositions = new Vector3[0];
    then replaced this block (line 398) with
    Code (csharp):
    1. Array.Clear(crossFadePositions, 0, crossFadePositions.Length);
    2. Array.Resize(ref crossFadePositions, crossFadeFrame.Length);
    3. Array.Copy(crossFadeFrame, crossFadePositions, crossFadeFrame.Length);
     
    Last edited: Dec 23, 2016
    ZJP likes this.
  33. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Hey everyone! I'm SUPER excited to announce that I've submitted version 1.5 for approval! It comes with a TON of new features and tons of performance improvements.

    This includes probably the most requested and anticipated feature, the ability to expose transforms! You can now have child objects just like your original animated assets! Some other notes, I've completely re-written the mesh combination code to support sub-meshes/multi-materials and redone cross-fading completely to support even more meshes. I've also almost completely eliminated all GC allocation after the initial frame generation!

    Here's a full list of stuff in this update:

    Version 1.5
    Improvements and Changes:

    Added support for exposing transforms! Have animated child transforms just like in the original object.
    Added support for multiple materials and submeshes!
    New support for root motion animations. None, baked, or apply the motion to the transform at runtime.
    Added support for the Optimized Game Objects option in the model importer.
    No more need for an animation controller for baking, just add your clips and bake!
    Baking humanoid rigs should work much, much better, on a wide variety of objects.
    Completely re-wrote mesh combining to be more efficient and accurate.
    Completely re-wrote crossfading code, increasing performance and reducing garbage allocations.
    Adding custom clips can now be done by selecting root assets.
    Added an option for skipping the last frame of animation for looping animations.

    Fixes:
    Greatly reduced garbage collection in mesh frame generation.
    Play() method is now case-sensitive.
    Phantom bake objects will no longer appear and remain in the scene after baking.
    Bounds for meshes while crossfading should now be correct.

    And here's a little test scene I've put together!


    As always, let me know if you have any questions!

    -j
     
  34. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    Great stuff... Thanks for all the great updates and support since release..

    Have no idea if this is even possible, but have you put any thought into baking blended animations ? Example would be upper body attack animation blended with lower body running ..
     
  35. JonDadley

    JonDadley

    Joined:
    Sep 2, 2013
    Posts:
    139
    1.5 looks great! Are there any improvements to the speed of the 'Pre Generate Frames' option at all? That's causing some issues for me with my level load times, it'd be great if there was any way to speed that process up at all.
     
  36. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    It should be a little faster in this version as I've improved performance across the board. I could look into maybe doing this step asynchronously. With Unity's new job system coming out I'll probably make a new version for newer versions of Unity that take advantage of the new system and it's ability to edit native Unity objects in separate threads.

    Also FYI everyone, version 1.5.1.1 it's been approved and is available to download.
     
    JBR-games likes this.
  37. JonDadley

    JonDadley

    Joined:
    Sep 2, 2013
    Posts:
    139
    That would actually be ideal, not only does the current method take a long time it also stalls the game really heavily - in VR this drops the loading screen back to the VR compositor screen which is less than ideal. Doing it asynchronously would also avoid the stalling, right? Faster and with less stalling would be a huge improvement :)
     
  38. abhinandand91

    abhinandand91

    Joined:
    Dec 22, 2015
    Posts:
    6
    If my requirement in game is 150 unique characters animating will this Mesh animator tool help me ?
     
  39. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    If each characters mesh is different, it won't give you as much of a performance benefit as characters that are the same, but it will help not having the overhead of the skinned mesh renderers. By having each character unique it might also depend on the characters vertex count as well when it comes to memory consumption. How complex is each character? (vertex count, animation length?)
     
  40. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    Is it possible to make the animations start at different frames?

    Or even manually call each frame from a separate script?
     
    Last edited: Jan 21, 2017
  41. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    It was possible by changing the current frame variable, but I must have messed up this feature in the last update. I'll have a fix for you tomorrow.
     
  42. StaffanEk

    StaffanEk

    Joined:
    Jul 13, 2012
    Posts:
    380
    @jschieck

    Thank you very much. I thought I was hallucinating about doing that earlier.
     
  43. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    PM'd you the fix.

    Everyone else the fix has been submitted to the asset store. Added:
    Code (CSharp):
    1. SetTime(float time, bool instantUpdate);
    2. SetTimeNormalized(float time, bool instantUpdate);
    to the MeshAnimator script. Sorry about that!
     
  44. jason-fisher

    jason-fisher

    Joined:
    Mar 19, 2014
    Posts:
    133
    Looks like great progress on an excellent asset -- purchasing now.

    This might be a little out there, but would it be possible to apply algorithmic squeeze/stretch/hourglass-type mesh effects at the shader level? Maybe a simple xyz scale? This could provide a lot of variation to a crowd without increasing draws?
     
  45. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    Yeah there's no reason why this wouldn't work. Any shaders out there should work. You could also just scale the transform itself, since each crowd member has its own.
     
  46. dworm

    dworm

    Joined:
    Jun 17, 2015
    Posts:
    74
    I get this error when baking even though apparently everything works fine

    NullReferenceException: Object reference not set to an instance of an object
    MeshAnimation.Reset () (at Assets/MeshAnimator/Scripts/MeshAnimation.cs:207)
    UnityEngine.ScriptableObject:CreateInstance()
    MeshAnimationCreator:CreateSnapshots() (at Assets/MeshAnimator/Editor/MeshAnimationCreator.cs:520)
    MeshAnimationCreator:OnGUI() (at Assets/MeshAnimator/Editor/MeshAnimationCreator.cs:426)
    UnityEditor.DockArea:OnGUI()

    Anything to fix it?
     
  47. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    If you update to the latest version in the asset store, this error should be fixed.
     
  48. HummerBumble

    HummerBumble

    Joined:
    Apr 13, 2013
    Posts:
    20
    Hi I was wondering how/if you are able to get multiple types of meshes running through the mesh animator at the same time. I tried creating two different mesh animations and instantiating them, but this is my result. Some models work and others don't.

     
  49. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    429
    I'm not sure if I fully understand what you mean by two different types of meshes, but I think you mean two meshes that share the same animation?

    If that's the case, you need to have each source mesh in separate folders. Then bake each one using the same animations. Otherwise it'll overwrite each other. Meshes that are different need their own set of MeshAnimation assets.

    If I misunderstood the question let me know.
     
  50. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    108
    Hello,

    I read something about layer Support. Using the Mecanim-Converter-Script + an Animator Controler with different layers ( one layer just for one arm and the others managing the rest), it doesn't work for me. I think the online documentation is a bit outdated, so I wanted to ask if there is support of Mecanim layers and weights or not.