[RELEASED] GPU Instancer - Crowd Animations

Sometimes, Unity does not import Compute Shaders correctly, which is most likely the reason for these errors. Please try right clicking and selecting Reimport on the GPUInstancer-CrowdAnimations/Resources/Compute folder.

thanks (testing in 2019.4 project now so didnt have errors).

trying to use this to randomize clips, this doc page seems to be bit old
(missing some of the new settings)
https://wiki.gurbu.com/index.php?title=GPU_Instancer:GettingStarted#Crowd_Animator_Randomizer

i have randomize clips enabled, animator has many clips (can see them in “default clip” dropdown),
but all characters still play same default anim…

code never goes into that debug log i added as a test (its before the random clips would happen)
image

Hi there,

Please make sure that the animations are baked and the Crowd Animator is selected.

Note that this component randomizes clips only once when it is enabled. If you are spawning characters at runtime after this component is already enabled, the newly spawned characters won’t be affected.

You can call the RandomizeAnimations() method from a script or enable the component after spawning the characters to ensure they are affected.

Thanks, got it working (it was n the demo scene, so it had the example script for spawning objects and modifying settings in the crowd animator)

btw. do you have tips for handling large crowds?
Instantiating them is bit slow (+10k characters) or pre-populating them as additive scene kills unity… (with that many gameobjects).

You can use the No-GameObject workflow if you have some programming experience. For an example, check out the NoGameObjectsDemo scene.

Hi all, I have a question, Can I use Enable Bone Update mode in No-GameObject workflow solution?
Thanks for read.

Enable Bone Updates updates the transform of the bone GameObjects. If there are no GameObjects, this feature cannot be used. However, you can create a custom job similar to ApplyBoneUpdatesJob in GPUICrowdRuntimeData.cs. Instead of applying the position, rotation, and scale to the transform, you can write these values into an array for use in your scripts.

1 Like

Just noticed the default HDRP Unlit shader isn’t converted to the GPUI Crowds format :slightly_frowning_face:

1 Like

Hi there!

We are using GPU Instancer + Crowd animations in our game, which also includes active time controls where users can fast-forward or slow down the game.

We have been seeing some issues with animation events set up via the CrowdManager where it looks like animation events can be skipped and not invoked with varying game speeds. We have also encountered issues with animation events on the last frame sometimes being skipped.

Has anything like that ever been reported or do you have anny suggestions for us? Would appreciate any input!

I want to ask if there is any example about ApplyBoneUpdatesJob in GPUICrowdRuntimeData.cs .

Hi there,

I checked the logic for the for the event triggers. It looks like if the “deltaTime” is high enough to restart the animation before the event triggers, the event is skipped for looping animations.
Please try making the following modification and see if it solves the issue:
GPUICrowdAnimator.cs change line 362 from this:

if (gpuiAnimationEvent.eventFrame <= currentClipFrame && (gpuiAnimationEvent.eventFrame > previousClipFrame || previousClipFrame > currentClipFrame))

to this:

if ((gpuiAnimationEvent.eventFrame <= currentClipFrame && (gpuiAnimationEvent.eventFrame > previousClipFrame || previousClipFrame > currentClipFrame)) || (!clipData.IsLoopDisabled() && currentClipFrame < previousClipFrame && previousClipFrame < gpuiAnimationEvent.eventFrame))

If you have trouble changing the code or if the issue persists after making this modification, please contact the support email, and I’ll be happy to assist you.

I don’t have demos for this specific case, but if you reach out to the support email with details on what you’re trying to implement, I can look into providing an example.