Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Mesh Animator - Highly efficient animated crowds, fully animated GPU instancing, and more!

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

  1. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    388
    @jschieck
    hi,
    does it support on Android?
    and URP? [Universal renderpipeline]
     
  2. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    403
    Yes it works on all platforms and doesn't require special shaders or materials so it should work for all shaders that work in that pipeline.
     
  3. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    388
    nice :]
    i want to using this on Emerald Ai ...
    so, is it possible? Emerald Ai have your own animation controlling system! howto do that?
    and howto using this on network?? like as Mirror?
     
  4. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    403
    You would have to write custom scripts to work with a 3rd party system.
     
  5. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    388
    ok ... but can you inform me howto integrated this with ai systems theoretically?
    for example if i want to using this with uzAi, needs to bake the character prefabs with predefined animations before using on Ai or first defining that prefabs on Ai system and after (when ai was generated their animator and controllers and etc) have to baking with Mesh animator?? its confusing :\
    or what??

    thanks.
     
    JBR-games likes this.
  6. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    630
    My advice would be to bake a limited set of animations with Meah Animator. 2-4. (Idle, walk, run, attack) use some sort of LOD system and only use them for characters that are say 50m away. So you will use a very basic state Machine(like the one included with MA) that is in use at the proper LOD levels. From there you can still use the NavMesh agent and base the animations off the speed of the agent, or the ai state like attacking.
     
  7. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    630
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. public class JBR_MeshAnimator_Controller : MonoBehaviour {
    4.     private MeshAnimator meshAnimator;  //mesh animator component
    5.     public NavMeshAgent navAgent;        // if using a navmesh agent add it here
    6.     private float navAgentCurSpeed;        // current speed of navmesh agent
    7.     private float topSpeed;                //nav agents speed
    8.     public float transitionSpeed = .75f; // speed at which to transition from  walk to run Animation
    9.     public string curAnimation;            //last animation started
    10.     public float updateSpeed = 0.2f;        //how often animation data is checked, at .2 update 5 times a second ,   in most cases there is no need to check this everyframe.
    11.     public string MA_Walk;  //add the correct name for the walk animation here, this animation should be set to loop
    12.     public string MA_Run;    //add the correct name for the run animation here, this animation should be set to loop
    13. void Awake()
    14. {
    15.      navAgent = this.gameObject.GetComponentInParent<NavMeshAgent> ();
    16.      meshAnimator = this.gameObject.GetComponent<MeshAnimator> ();
    17. }
    18. void OnEnable()
    19.     {
    20.      topSpeed= navAgent.speed;  //max speed of navmesh agent
    21.      InvokeRepeating ("SlowUpdate", updateSpeed, updateSpeed);
    22. }
    23. void SlowUpdate()
    24. {
    25.     curAnimation = meshAnimator.currentAnimation.ToString ();// last animation started
    26.     navAgentCurSpeed = navAgent.velocity.magnitude;    //current speed of navmesh agent
    27. if (navAgentCurSpeed <= transitionSpeed)
    28. {
    29.    if (curAnimation == "Zomb_Walk (MeshAnimation)") //if we are already using the correct animation ,only adjust the speed.
    30.   {
    31.      meshAnimator.speed = navAgentCurSpeed /transitionSpeed;
    32.   } else {     // we need to set the correct animation
    33.      meshAnimator.Play (MA_Walk);
    34.      meshAnimator.speed = navAgentCurSpeed /transitionSpeed;
    35.   }
    36. if (navAgentCurSpeed > transitionSpeed)
    37.   {
    38.     if (curAnimation == "Zomb_Run (MeshAnimation)")
    39.     {
    40.        meshAnimator.speed = navAgentCurSpeed /topSpeed;
    41.     } else {
    42.        meshAnimator.Crossfade (MA_Run , 0.25f );
    43.        meshAnimator.speed = navAgentCurSpeed /topSpeed;
    44.            }
    45.         }
    46.      }
    47. }
    48.  
    This is something basic i posted some time ago may have to tweek it to work still.
     
    jschieck and Davood_Kharmanzar like this.
  8. noahx

    noahx

    Joined:
    Nov 22, 2010
    Posts:
    52
    Hi,
    I'm getting an error when closing the game, but unfortunately it is not consistent in the steps to reproduce it. The only thing consistent is the line of code that is throwing the error in the MeshAnimator.cs script. The problem happens when using Crossfade to play animations (instead of the simple "Play"). In terms of what I can see in game as player, I think the problem is that two crossfading events are happening sort of at the same time, causing some problems later. What I mean is, I play an animation using crossfade, and while the elapsed time for that crossfade is still in progress (let's say 0.5f seconds), I play another animation also using crossfade (before the first crossfade ends), and I think that's what is causing a shift in the index that is crashing the script.

    First things first, I'm not a coder but I understand some of the code more in the terms of logic and things out of place (errors) and not necessarily how to code/implement it. But this is the error left in console:

    NullReferenceException: Object reference not set to an instance of an object
    FSG.MeshAnimator.MeshAnimator.OnDestroy () (at Assets/MeshAnimator/Scripts/MeshAnimator.cs:335)


    More details of the same error:
    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    at System.Collections.Generic.List`1[System.Collections.Generic.Stack`1[UnityEngine.Mesh]].get_Item (Int32 index) [0x0000c] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633
    at FSG.MeshAnimator.MeshAnimator.OnDestroy () [0x00142] in I:\Dev\P7\Assets\MeshAnimator\Scripts\MeshAnimator.cs:335


    And that line of code corresponds to this:
    meshStack = s_crossFadePool[crossFadePoolIndex];

    So, based on the error and on the idea of that line of code, it is clear that the index (crossFadePoolIndex) is out of bounds in relation to the stack s_crossFadePool.
    I added logs to check on the index value and the element count of that stack and it proved that situation:
    s_crossFadePool Count: 4
    CrossFadePoolIndex: 5
    That line of code is throwing an error because it is trying to get an element in the position 5 when the stack only has 4 elements. How did that index got increased to 5 and the stack got only 4 elements? I don't know and that's the part I've been dealing with.

    This is just a reference from the documentation, and going back to the initial description of the problem, the index (CrossFadePoolIndex) is getting increased but the stack is not, and I think it is because a crossfade is being called while another crossfade is still in progress (before the float speed parameter ends), so because the crossfade didn't complete, it is not added to the stack, but the index is increased and that's when the fun begins:
    meshAnimator.Crossfade(0, 0.5f);

    So, what I did as a "temporary fix/workaround" is, I added a validation before that block of code that is crashing:

    if (crossFadePoolIndex < s_crossFadePool.Count)
    {
    ....
    }


    If the above statement is true, then proceed to execute that block of code, otherwise do nothing. But my only concern is, are there any risks doing that in terms of memory leaks? Because the error is in the "OnDestroy" event, I wonder if because of the messed up index, it will mean that some meshes didn't get destroyed and it will continue to consume memory from scene to scene.

    Thanks.
     
  9. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    403
    By exiting the game do you mean closing the application or switching scenes? In either scenario, your fix will work as the meshes generated will be cleaned up by Unity.
     
  10. noahx

    noahx

    Joined:
    Nov 22, 2010
    Posts:
    52
    Sorry. Closing the application. I haven't tried switching scenes. But if I switch to another scene, every object in the previous scene will execute the "OnDestroy" event, right?
     
  11. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    403
    Correct. If your closing the app you don't need to worry about it. Everything in memory is getting disposed anyway, which is probably what is happening here.
     
  12. noahx

    noahx

    Joined:
    Nov 22, 2010
    Posts:
    52
    Well, I'll continue working on the game keeping that "fix" and I'll pay attention on the memory, to see is it goes ballooning at some point during memory benchmarks and I'll let you know.

    Thanks.
     
  13. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,785
    Still my fave thing
     
  14. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,785
    Looks legit
     
  15. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    388
    @jschieck
    hi,
    is it possible to indirect instancing mesh animators?
    i tried to do with GPU Instancer ... but does not working :[

    so, any suggestion?
    or can you provide an special indirect instancing for that?
    i have about 2K zombies!! on PC everything is good [60 fps] but on android with 10 zombies i got 8-12 fps :[
    thanks.
     
    Last edited: Oct 21, 2019
  16. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,785
    I was thinking the same thing. in essence you would have to re work the instancing code to walk through the baked animations I guess. as opposed to it's own baking system (I thought)

    You would have to eyball the code.
     
  17. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    403
    Yes while possible you'd have to manually compile all meshes and instances on a given frame. I don't include this functionality out of the box to support the wide range of users in the asset store, and I doubt it would be faster than unity's internal GPU instancing code.
     
    JBR-games and twobob like this.
  18. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,785
    You might want to check that's not a geometry based cap on the Android. Just saying... sounds like a possibility.
    Certainly bears testing that the bottleneck is where you think it is.
     
  19. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    99
    Hi,
    We are using MeshAnimator with low compression accuracy for artistic reasons.
    Now, I need one frame of the MeshAnimator Animation as a readable mesh file.
    I tried a few assets that allow you to export almost anything as a 3D model out of Unity in playmode, but in this case
    the exported object was randomly missing big chunks of faces.

    I just wanted to ask if you have any idea or a tip for us, how we can save one animation frame as a 3D model.
    I guess there is no such function included?

    Best regards,
    Daniel
     
    twobob likes this.
  20. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,785
    would it need to be like rigged and skinned?
    or would just the mesh do?

    Seems like outing the mesh is something that is doable. as for the rig and and skinning. not so sure about that.
    I seem to recall there are editor scripts that let one walk meshes at a specific moment and copy them.

    https://answers.unity.com/questions/39311/editor-scripting-how-to-save-a-script-generated-me.html reasonably sure that will be helpful in getting you a few lines of code for job

    or even https://forum.unity.com/threads/how-do-i-duplicate-a-mesh-asset.35639/ and just rip out the editor bit

    which would be like hacking https://github.com/pharan/Unity-MeshSaver really
     
    Last edited: Oct 29, 2019
    HenryChinaski likes this.
  21. HenryChinaski

    HenryChinaski

    Joined:
    Jul 9, 2013
    Posts:
    99
    Hi and many thanks for your help!
    I want to use the RayFire asset to fracture the model. So I need only the mesh!
    The last plugin you linked worked perfectly!
     
  22. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,785
    No worries Henry.
     
  23. Yurijh

    Yurijh

    Joined:
    Nov 4, 2016
    Posts:
    10
    How can I control the MeshAnimator through Animator calls?

    I have baked with MeshAnimator a large number of FBX that I used to control through setFloat, setBool, setTrigger etc. I also have several transition options, exit times, etc everything set in a series of complex AnimatorController. Is there a way to make this communication transparent or I need to implement all the set methods inside MeshAnimator.cs?

    In the provided example you show how to control a MeshAnimator through an active Animator. But after the bake process, I have an object with no Animator, so I have no animators running.

    How do you suggest to cope with this problem? I think it's very common.
    I cannot rewrite all the animation calls, I really need to leave the calls and the animator logic untouched.
    I hope I was clear enough, if you need more details, just ask.

    Thanks in advance.
     
  24. noobynobody

    noobynobody

    Joined:
    May 9, 2019
    Posts:
    76
    Based on your experience, does this asset improve performance for mobile if there aren't that many models on the screen (let's say 10)?
     
  25. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    403
    You can inspect the state of the animator and it's currently playing animation, then use that to call the Play method on the MeshAnimator. But beware using lots of Animator's has it's own performance overhead so leaving that on your prefabs will hurt overall performance when you start getting lots of animators.

    You probably won't see much performance difference with only 10.
     
  26. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    403
    Happy Thanksgiving everyone! I'm thankful for all of your support of Mesh Animator over the years!

    I've put together a beginner tutorial showing the process of what it's like converting an existing Animator prefab into a Mesh Animator one and the performance gains that can be had. Enjoy, and as always let me know any questions you may have!

    And if you haven't already, Mesh Animator is 50% off right now for Black Friday so go grab your copy!

     
    Last edited: Nov 28, 2019
    Wenceslao likes this.
  27. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    350
    @jschieck Lol. Bought this way back in Feb, 2017 and have managed to never actually use it! Now I'm ready for it and finally there's a video that makes sense of the process. I think I'm good to go! It's like the potential I saw in this asset all those years ago is about to pay off :D

    ps. it would really help if you talked through your videos. Your walk through's a little haphazard and it took me quite a few rewinds to work out quite what you were doing at certain points. I'm just talking about the Mesh Animator conversion, the normal mecanim and basic AI scripting makes perfect sense. It's just that it's really important to explain why you're making certain decisions when explaining an asset like this.

    I'd love to see a follow up detailing the set-up for characters that switch to normal mecanim NPCs at LOD0
     
  28. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    513
    Hi. I'm trying to start using MA for my character but I got couple of errors !! I tried to follow the doc and tutorial but not change. Here is my character file:
    https://gofile.io/?c=NnlDaW
    Check it please, I'm using 2019.2.17 ver.
     
    Last edited: Jan 8, 2020
  29. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    388
    @jschieck
    hello,
    can you provide this asset with Unity Jobs?
     
    Last edited: Feb 2, 2020
    JBR-games likes this.
  30. JDSweet

    JDSweet

    Joined:
    Sep 4, 2018
    Posts:
    7
    I wish to make a Total War esque game. The total number of entities I would have to deal with has to be able to reach 10,000 to 20,000 max in a battle (though only 1000-2000 would likely be on screen with any real level of detail) at any given point in time. I've been browsing assets, and yours appears to be the best documented, so I have some questions:

    (1) Is it possible to access individual instanced entities? For example, based on your zombie video, it looks like I'd be able to add scripts to/control via code which animations are playing and what position the instanced objects will be drawn at.

    (2) I can instance multiple different models with this asset, right? So, for example, I'd have maybe 6-10 or so unique models to be instanced at a time, with 200 of one model, 500 of another, and 800 of yet another (with both sides having similar numbers).

    (3) Does your asset support all animation formats? For example, let's say I want to import some .mocap files, and then some other .anim animations from a different asset.

    (4) Individual entities can transition between LOD levels, right? For example, a player may zoom into the "battle" and see units with 0.1, and then they'd zoom out to see 0.001 and vice versa.

    (5) https://assetstore.unity.com/packages/3d/animations/takedown-animations-19072

    I'm mainly going for a wider strategic gameplay perspective, so there'd be very low LOD's (so I'd be using your 0.001 compression option more often than not if that impacts your answer). I'm looking to do something like this (with less visual quality of course)


    I'm just looking for a graphical extension that will allow me to display armies and such without having too much graphics knowledge, for reference -- I've already got most of the "strategy" logic up and running so far.
     
  31. JDSweet

    JDSweet

    Joined:
    Sep 4, 2018
    Posts:
    7
    Is there any way you could share how you did this with me an/or share the code you used?
     
  32. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    630
    since he seems totbe away...
    I used Mesh Animator a bit and may be able to help with some of the questions...
    1)each Mesh animator can have a seperate script or navmesh or what ever you like..
    2) you can add as many different models as you like with differwnt animations.. but it uses more memory to do so..
    3)you should be able to use any animation format that unity allows. but there is no animation blending like in unity mecanim.
    4) i would advise looking into another asset for further LOD levels. you can add a Unity LOD to any gameobject. these both allow you to bake further down to sprites..
    https://assetstore.unity.com/packages/tools/sprite-management/sprite-baking-studio-3d-to-2d-31247
    or
    https://assetstore.unity.com/packages/templates/systems/3d-sprites-50386
    but with either one youll need to write your own sprite player code.. or pm me and i can give you a test one i wrote.
     
  33. Carterryan1990

    Carterryan1990

    Joined:
    Dec 29, 2016
    Posts:
    78
    I would love to share. Please research Draw mesh instanced indirect. Also research mesh texture animations. Finally you’ll need to learn about shader buffers. To hold Position and rotation values. Once you’ve learned these 3 things you’ll be able to have millions of animated characters on screen. Once you get to this point I’ll be happy to continue to assist!
     
  34. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    403
    Sorry for the late response, it's been a busy month around here. Thanks for filling in @JBR-games!

    Yes each instance is it's own gameObject and can have it's own scripts.
    Yes, you'd simply bake them separately and instantiate them.

    As long as the animation file can be applied to a skinned mesh, it should work in the bake process. Though I haven't tested with mocap files.
    Yes each entity can use either the built in LOD to animate less frames, or utilize it's own LOD Group script.
    Should work, again as long as it can be applied to skinned mesh.

    If you're looking to do this type of project, 20k unit's is easily achievable as long as each model is well optimized regarding textures, shaders, and geometry. You're bottleneck will not be the rendering, but the optimization of the AI and other scripts associated with running that many instances. DOTs would definitely be the way to go here. Though MeshAnimator doesn't directly work with DOTs, the two could interface with each other, using DOTs for the simulation, and MA for the animation rendering.
     
    JBR-games likes this.
  35. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    630
    have you put any thought into building a dotz compatible mesh animator system?
     
    Zypo likes this.
  36. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    513
    I can't use your asset because errors.
    I make character by blender and upload it to maxiom to get package of animations. In unity i get couple of errors and I couldn't do it.
    Update it please.
     
  37. Hobodi

    Hobodi

    Joined:
    Dec 30, 2017
    Posts:
    27
    Hi, your asset is awesome but i would like to ask for some features:
    1. Bake mesh filters from one prefab separetly. It will be usefull for customizing characters parts and enabling runtime.
    2. Synchronization system for parts of animations.
    3. Maybe some ecs and little bit of dots implementation. It can give good performance and for things like framesyncrhonization with one characters entity it can be good. Entites 1.0 coming out soon and it must be almost stable now.
    Thank you.
     
    JBR-games likes this.
  38. wwz456

    wwz456

    Joined:
    Jun 9, 2019
    Posts:
    5
    report error
     

    Attached Files:

  39. Pourya-MDP

    Pourya-MDP

    Joined:
    May 18, 2017
    Posts:
    86
    Hey every one
    I interested in this asset but have a simple question
    Lets say i have 100 to 150 characters in scene each have 400 tris
    Would this asset handle that number in scene for low end mobile devices?
    Or lets say how much is ideal for low end devices?
     
    JBR-games likes this.
  40. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    630
    what do you consider low end mobile ?

    150 characters is 60k tris alone, plus the hit to memory and hit from code swapping the character freeze frames.. this system beats the hell out of using mecanim but it can only do so much.

    build a scene for your target device with atleast 80k tris worth of characters using a mesh Renderer/filter not a skinned mesh Renderer/ filter and see how it runs.
     
    Pourya-MDP likes this.
  41. gitlinjoss

    gitlinjoss

    Joined:
    Mar 16, 2020
    Posts:
    6
    Hey man. I bought your tool and followed the video tutorial for it, and all was working fine until I swapped my mesh animated prefab into the spawner script. Instead of generating 100 copies like it did before with the original prefab, it generates 100 copies and then 100 more copies and 100 more and more until unity freezes. Any idea what I'm messing up?

    EDIT: nevermind! figured it out, I was spawning the meshanimator object which reran the ieunumerator spawning function each time a new clone was spawned. top kek
     
    Last edited: May 9, 2020
  42. gitlinjoss

    gitlinjoss

    Joined:
    Mar 16, 2020
    Posts:
    6
    Ok I have a real question for you now. I'm trying to generate a crowd without any animated mesh objects overlapping each other (so it looks more realistic). I've modified your CrowdSpawner script for my purposes, and I'm using Physics.OverlapBoxNonAlloc to detect colliders. However it's definitely not working right. Collisions are detected according to my debugging info, but not in the right places because my crowd members still overlap.

    Here is my code:
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections.Generic;
    4. using FSG.MeshAnimator;
    5. using UnityEngine.SocialPlatforms;
    6.  
    7. public class Spawner : MonoBehaviour
    8. {
    9.    public Transform target = null;
    10.    public GameObject spawnPointer = null; // contains child spawn points
    11.    public GameObject spawnPrefab = null;
    12.  
    13.    [Range(0,500)]
    14.    public int sizeOfCrowd = 1; // default start size
    15.    private int size = 0;
    16.  
    17.    private List<GameObject> spawnedObjects = new List<GameObject>();
    18.  
    19.    public float overlapTestBoxSize = 10f;
    20.  
    21.    void SpawnCrowd()
    22.    {
    23.        foreach (var obj in spawnedObjects)
    24.            if (obj) Destroy(obj);
    25.  
    26.        spawnedObjects.Clear();
    27.        List<int> occupiedSpaces = new List<int>();
    28.        for (int i = 0; i < sizeOfCrowd; i++)
    29.        {
    30.            if (i > transform.childCount)
    31.                occupiedSpaces.Clear();
    32.            int space = Random.Range(0, spawnPointer.transform.childCount);
    33.            while (occupiedSpaces.Contains(space))
    34.                space = Random.Range(0, spawnPointer.transform.childCount);
    35.  
    36.            var g = GameObject.Instantiate(spawnPrefab);
    37.            g.transform.position = spawnPointer.transform.GetChild(space).position + new Vector3(Mathf.Round(Random.value*44), 0, Random.value*2); // spawn prefabs at random locations along line
    38.            g.transform.LookAt(target, Vector3.up);
    39.  
    40.            {
    41.                Vector3 overlapTestBoxScale = new Vector3(overlapTestBoxSize, overlapTestBoxSize, overlapTestBoxSize);
    42.                Collider[] collidersInsideOverlapBox = new Collider[1]; // only needs to find one collider overlap
    43.                int numberOfCollidersFound = Physics.OverlapBoxNonAlloc(g.transform.position, overlapTestBoxScale, collidersInsideOverlapBox);
    44.                if (numberOfCollidersFound == 0)
    45.                {
    46.                    if (g.GetComponentInChildren<MeshAnimator>())
    47.                    {
    48.                        MeshAnimator ma = g.GetComponent<MeshAnimator>();
    49.                        ma.defaultAnimation = ma.animations[Random.Range(0, ma.animations.Length)];
    50.                        ma.speed = Random.Range(0.9f, 1.1f);
    51.                    }
    52.                    spawnedObjects.Add(g);
    53.                    print("spawning");
    54.                }
    55.                else
    56.                {
    57.                    spawnedObjects.Remove(g);
    58.                    Destroy(g); // remove overlapping prefab
    59.                    i--; // redo spawn in new area
    60.                    print("collision");
    61.                }
    62.            }
    63.        }
    64.    }
    65.    private void FixedUpdate()
    66.    {
    67.        if (size != sizeOfCrowd) // check when crowd size slider is modified
    68.        {
    69.            CancelInvoke("SpawnCrowd");
    70.            Invoke("SpawnCrowd", 1);
    71.        }
    72.        size = sizeOfCrowd;
    73.    }
    74. }
    75.  
    Any pointers or tips with this would be greatly appreciated :D
     
    Last edited: May 9, 2020
  43. ziggyshawc

    ziggyshawc

    Joined:
    May 11, 2020
    Posts:
    4
    Does this have ecs integration? IE does it have the equivalent of these shadergraph tickboxes:
    upload_2020-5-19_17-11-59.png
    Which lets you set properties by changing ECS components.
    I'd buy this immidiately if I can change the animation via ECS/ hybrid render v2.
     

    Attached Files:

  44. tntfoz

    tntfoz

    Joined:
    Sep 29, 2016
    Posts:
    115
    Hi there I'm encountering a problem with MA currently that I hope you can help sort out. I've been seeing "Invalid SceneHandle" errors in the log which result in the Unity editor (2018.4.8 LTS) lagging so badly that I have to quit it.

    Although builds are a bit better these errors are still reported, and changing scene results in everything slowing to a crawl forcing a quit.

    The error in the output_log has little relevant information unfortunately:

    Invalid SceneHandle
    (Filename: C:\buildslave\unity\build\Runtime/Camera/RendererScene.cpp Line: 338)

    I did manage to get a CTD with one of my builds which created an error dump and log for the crash with extra info:

    Multiple instances of this error for different threads:

    Call Stack for Thread 20440:
    0x00007FFC7251F9A4 (ntdll) NtWaitForAlertByThreadId
    0x00007FFC724E0815 (ntdll) RtlSleepConditionVariableCS
    0x00007FFC6FF8C2B9 (KERNELBASE) SleepConditionVariableCS
    0x00007FFC1FD611CC (mono-2.0-bdwgc) mono_threads_attach_tools_thread
    0x00007FFC1FE15FC3 (mono-2.0-bdwgc) mono_threads_set_shutting_down
    0x0000028246BF70E3 (mscorlib) System.Threading.Thread.SleepInternal()
    0x0000028246BF6FEB (mscorlib) System.Threading.Thread.Sleep()
    0x0000028246BF6DEB (Assembly-CSharp) FSG.MeshAnimator.MeshAnimator.GenerateThreadedCrossfade()
    0x0000028246BF6B56 (mscorlib) System.Threading.ThreadHelper.ThreadStart_Context()
    0x0000028246BF681E (mscorlib) System.Threading.ExecutionContext.RunInternal()
    0x0000028246BF664B (mscorlib) System.Threading.ExecutionContext.Run()
    0x0000028246BF656B (mscorlib) System.Threading.ExecutionContext.Run()
    0x0000028246BF6483 (mscorlib) System.Threading.ThreadHelper.ThreadStart()
    0x0000028246BF63E4 (mscorlib) System.Object.runtime_invoke_void__this__()
    0x00007FFC1FE6A69B (mono-2.0-bdwgc) mono_get_runtime_build_info
    0x00007FFC1FDF1BB2 (mono-2.0-bdwgc) mono_perfcounters_init
    0x00007FFC1FDFAD72 (mono-2.0-bdwgc) mono_runtime_invoke_array
    0x00007FFC1FE1510F (mono-2.0-bdwgc) mono_threads_set_shutting_down
    0x00007FFC1FE14E56 (mono-2.0-bdwgc) mono_threads_set_shutting_down
    0x00007FFC719D7BD4 (KERNEL32) BaseThreadInitThunk
    0x00007FFC724ECE51 (ntdll) RtlUserThreadStart

    With the GenerateThreadedCrossfade() function mentioned I thought to test again with the THREADS_ENABLED define commented out but that actually didn't make any difference.

    Pretty sure the Invalid SceneHandles are logged when I deactivate the entities with MA components on them, but it doesn't happen in every case, probably about 1 in 20. However threads losing references would kind of explain the laggy behaviour in the editor and build.

    There are also occasional "System is not interested in this transform, SetSystemInterested may only be called on transforms that are set interested." errors that show in the editor for the same MA entities, usually alongside Invalid SceneHandle errors, but no other info reported, which may or may not be related?

    We're not talking any more than 300 MA entities in the scene at most, although these errors can happen when fewer have spawned (all entities are pooled and not destroyed). I don't think the number of entities is the problem, just that there's a higher chance of an error occurring with more entities to observe.

    Could you give me some pointers where to look in fixing this?


    Thanks.
     
    Last edited: May 26, 2020
  45. tntfoz

    tntfoz

    Joined:
    Sep 29, 2016
    Posts:
    115
    Okay I think I've resolved this - I was disabling the mesh renderers on the entities with MA components on them via some custom LOD logic. I believe the threaded tasks weren't happy with this in some circumstances, and were generating the Invalid SceneHandle errors as a result in both the editor and the build.

    If I leave the renderers enabled then these errors, and the "System is not interested in this transform" errors, both disappear.

    So no worries for now.

    There is zero info on the interwebs about either of these errors because I'm guessing it's so rare, and takes special circumstances to generate (many entities, disabled renderers, threaded tasks, etc) and it's intermittent at best.

    Glad I've got things working though. Thanks for MA - great asset!

    :)
     
  46. Wothanar

    Wothanar

    Joined:
    Sep 2, 2016
    Posts:
    111
    hi there, i bought this plugin today and i was wondering if its compatible with Unity 2019.3.14f1?
    thanks
     
  47. borbs727

    borbs727

    Joined:
    Jan 9, 2018
    Posts:
    3
    Just purchased this plugin and it doesn't seem to download. Unity version 2019.3.13f1
     
  48. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    403
    Yes it should be compatible.

    It doesn't download or doesn't correctly load? If it's not downloading, that might be an issue with the asset store.


    Sorry I didn't see your issue sooner, my forum email notifications stopped working :(

    No not at this time.
     
  49. jschieck

    jschieck

    Joined:
    Nov 10, 2010
    Posts:
    403
    Hi all! I've been working hard on Mesh Animator 2.0, which is a complete refactor and support for animation texture/shader animation, alongside the current tech, so they can work in parallel! It's not quite ready yet, but here's a little teaser video of one of the example scenes. 50 thousands units, each mesh it's own Transform and GameObject instance (no ECS instancing) with it's own AI and playing a unique animation. All with full GPU instancing!





    Looking forward to releasing the new version in the coming months!
     

    Attached Files:

    JBR-games and borbs727 like this.
  50. niflying

    niflying

    Joined:
    Jul 11, 2012
    Posts:
    78
    Any news about 2.0? can't waitting for this.
     
    JBR-games likes this.
unityunity