For anyone visiting in 2024 - I ended up needing this in a recent project and it seems to still work. Deployed to iOS using Unity 2022 LTS.
@Rdp03009 ай бұрын
no this is not working in unity 2021
@Rdp03009 ай бұрын
materials became purple... maybe shader is not supported in URP?
@ShahinRostami9 ай бұрын
@@Rdp0300 That may be the case - I've only used the built-in renderer. I think I remember seeing URP discussed in their GitHub issues, and someone may have linked a modified version for that supports it. Worth checking it out if that's what you're after.
@pablomonfortgames67236 ай бұрын
@@ShahinRostami wants hdrp version if not useless stuff , im stuck between pipelines and this damn feature.
@amac3333 жыл бұрын
could you offset their animations and still have the batching?
@brianknox37782 жыл бұрын
Wow, that is really involved! I am thankful that you took the time to show us the steps! Thank you!
@gabrieltarzia56404 жыл бұрын
You saved my Life. Thank you so much. But i need to ask , can i use this to instantiate and change animations in real time for only single of the meshs? Or all the meshs Will copy what the base mesh is doing?
@icebear785727 күн бұрын
Did you find an answer to this? I need to use GPU instancing in a game and the animations have to played when required.
@lawrence97133 ай бұрын
I almost got a heart attack when I looked at the bottom right to check the clock. Noway it could have been 18:19 already Great video. Saved to try it later
@ShikariVento5 жыл бұрын
Looks like season IV of Overlord.
@The_CubeMan4 жыл бұрын
I am on Unity 2020.1.8.f1 and everything is working until I hit 5:39, the step where I need the Asset Bundle Browser, which is no longer available in the Unity Package Manager. From my understanding Asset Bundles are now deprecated. Is there an alternative solution to this that works on the current version of Unity?
@mitchellryandev3 жыл бұрын
Did you find a solution?
@ViatcheslavTarasov3 жыл бұрын
@@mitchellryandev The solution: docs.unity3d.com/Manual/AssetBundles-Browser.html
@okandemirkaya90663 жыл бұрын
@@mitchellryandev You can dowloand via unity and upload unity using Package Manager.
@parsec3d3 жыл бұрын
Is there a way to make them use on the fly random variations or time offset sections of the animation?
@imaginationrabbit5 жыл бұрын
Excellent walkthrough/tutorial- thank you!
@ShahinRostami5 жыл бұрын
Thank you, I'm glad you found it useful!
@influency40754 жыл бұрын
Does it work with URP ? Thanks :)
@Kalificus3 жыл бұрын
bump
@kevincomerford22423 жыл бұрын
@@Kalificus NO. At least not out of the box. It needs to be converted.
@Galathea0005 жыл бұрын
It would be interesting to see what exactly takes up all the cpu time in the non instanced version. I doubt that draw calls account for most of that.
@skydrowdev3 жыл бұрын
Maybe something related with the bone transformations and the weights? Edit: after a bit of research, I found that all the skinning calculations are done in the CPU. That explains the bottleneck. Source: blogs.unity3d.com/2018/04/16/animation-instancing-instancing-for-skinnedmeshrenderer/
@al-iom5 жыл бұрын
I'm realy waiting for the next video of you modify the shader to make compatible with the animation instancing.
@atakanarkan67455 жыл бұрын
I did it step by step but in game view character is invisible how can ı solve this?
@germiyanbey15 жыл бұрын
Hi Dr. Shahin, any plan to cover modifying Standard Shader with adding vertex shader capability? It is mentioned at 3:33 in the video, but I couldn't find any tutorial or information about that, and Standard Shader is not accepting any edit. And Shaders that AnimationInstancing offers are very limited. Thanks for the great video, I will appreciate very much if there could be any Standard Shader support.
@ShahinRostami5 жыл бұрын
Hi - it’s something I’ve done myself using their documentation, but I haven’t made a video on it yet. Did you figure it out in the end?
@germiyanbey15 жыл бұрын
@@ShahinRostami I followed forums and some unofficial tutorials and it was a difficult process and it gave various different errors during the process. After I erased all errors by searching each error in internet, then I have these errors preventing the Shader working (I see these below three errors on .shader object in inspector). And I couldn't find a remedy to these last problems at the end, therefore I stopped working on this completely sadly. Errors (3): 1-unrecognized identifier 'UNITY_INSTANCING_BUFFER_START' Compiling Vertex program with DIRECTIONAL Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR 2-unrecognized identifier 'appdata_full' Compiling Vertex program with DIRECTIONAL Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR 3-Duplicate #pragma vertex found, ignoring: #pragma vertex vertBase
@germiyanbey15 жыл бұрын
Lastly, using Animation Instancing with Mesh Renderers seem to be very difficult process, which this method seemed to me not optimized for working with Mesh Renderers yet and need some modifications I think. If the Zombies in your video have swords or shields on the rigs (right hand and left arm) things easily go messy.
@louisedbrooke11895 жыл бұрын
Brilliant tutorial Shahin, I'm looking forward to the next one in the series!
@Athomield3D5 жыл бұрын
Thanks for the walkthrough !! Please don't forget attachements (non skinnedmeshrenderers like swords/weapons...) for the next video !
@ShahinRostami5 жыл бұрын
You're welcome! I'll make sure to include that in the following videos. It would be great if you had a particular model (asset store?) that you'd like me to use for the demonstration
@Athomield3D5 жыл бұрын
@@ShahinRostami sorry for the late reply. I have a project which I'm working on in which I have failed to get attachments to work. If you need a model I can send u one from my game. Otherwise any skninned mesh with any normal mesh would work ie. A shpere for a helmet. -regards
@ShahinRostami5 жыл бұрын
@@Athomield3D That would be great if you could send a model, this way I can see the exact issue when trying to create the animation texture. My e-mail is hello@shahinrostami.com
@80sOGRE4 жыл бұрын
Question - Which is more processor efficient ? 1) 100 chairs and tables combined as 1 object OR 2) 1 set of chairs and tables instanced 100 times and statically batched ?
@Rdp03009 ай бұрын
i cant see the asset bundle browser in package manager ? i am using 2021.3
@evaluator8906 Жыл бұрын
I have a character model that I wanna do this on but does the characters need to be able to batch if their Animator components are turned off? Because when I close them, they still don't batch...
@polygonware64692 жыл бұрын
What about the shadows video?
@Pablo-wi4gj2 жыл бұрын
The animatorController does not appear on the gameObject during the playmode, even though that it is attached in my prefab. How can I fix that?
@Th3Shnizz4 жыл бұрын
I mean it's really cool and all, but I wonder if it works the same way if all the animations aren't running at exactly the same time you know? Like seeing 1000 zombies all do exactly the same things at exactly the same times is not something that would be very interesting in game, however, if we look at a game like "World War Z" you can imagine how powerful this system would be if we can have 1000 zombies doing maybe a handful of different animations with each their own offset or whatever....
@okandemirkaya90663 жыл бұрын
Everything okay in editor, when I build a game to android, I get "Object reference not set to an instance of an object'" error. How I solve this problem ?
@okandemirkaya90663 жыл бұрын
I solved the problem. I load wrong bundle. We have load StreamingAsset->AssetBundle->animationtextures.
@zeggxr1539 Жыл бұрын
is it working with the different animation variants, like one of the zombies were walking the other will attack an the other will stand on idle etc...
@Haxel0rd2 жыл бұрын
While this is a nice tutorial with great advice, it seems to not work for HDRP without modifying the shader (tested in Unity 2021.3.2f1, HDRP, got pink zombie and ingame it did not appear and made game laggy).
@ItsSherifff Жыл бұрын
Is there any way to enable gpu instancing on this while using a custom shader graph?
@Trasqual2 жыл бұрын
This is great, thank you. But I have a problem while trying to change the color of my instantiated characters. I use property blocks to change color and it seems to work in the inspector but the renderered character is plain white. I tried changing the materialblock every frame but it didn't work either. Is there a work around? Thanks again
@nv72872 жыл бұрын
It would be nice to see how to modify a custom shader :) like toony colours shader and add shadows and other animations
@al-iom5 жыл бұрын
Hello Shahin, VERY GOOD JOB, it's realy amazing. I have question about shaders. Can I use shader graph instead animationinstance shader ? How if it's possible ? Many thanks.
@okandemirkaya90663 жыл бұрын
Thank you for asset. Everything okey in editor and pc but when I add 15 same model (zombie) in empty scene, fps decrease 15-20fps. How I do for solving this problem ? what should ı do for solving this problem ?
@krischmiel22312 жыл бұрын
Hi It works but my animation looks bad. My model sways
@alifkamaljauhari116111 ай бұрын
Hello! I am currently developing a VR application for Android focused on virtual concerts, using these assets to create the crowd. While in the editor, everything runs fine. But why is it that after building the application, all the crowd disappear? Do you have a solution?
@ShahinRostami11 ай бұрын
Hello! It's been years since I've touched this, but I remember it being an issue with the AssetBundle generation. All the best.
@alifkamaljauhari116111 ай бұрын
@@ShahinRostami Thanks but what should i do next?
@puneethraj40404 жыл бұрын
But these shader doesn't work with HDRP :(
@ShahinRostami4 жыл бұрын
Try creating an issue on the repo!
@puneethraj40404 жыл бұрын
@@ShahinRostami OKAY
@brianknox37782 жыл бұрын
NO SHADOWS: You ended it by saying you'd address "shadows" next, but I can't find this video. :( Was it problematic, or did you just have more important things to do?
@ShahinRostami2 жыл бұрын
Hey Brian! I can't remember what got in the way of these videos - it was likely work!
@sudarshanshetty17915 жыл бұрын
can you pls tell me how to play with multiple animations for a single character with the same method?
@ShahinRostami5 жыл бұрын
I'm glad you found it useful. I may make a video on this in future, but in the meantime here is how you do it: 1. In your script, create a public variable of type AnimationInstancing (use the AnimationInsttancing namespace) 2. In the Unity editor, drag over the GameObject which has the AnimationInstancing script attached to it, over to the newly created AnimationInstancing property in your own script. 3. You can now use the PlayAnimation(int index) or PlayAnimation(string name) method on the AnimationInstancing class (see github.com/Unity-Technologies/Animation-Instancing/blob/master/Assets/AniInstancing/Scripts/AnimationInstancing.cs)
@zxz89175 жыл бұрын
Hi, I wanna to ask you, I build project into exe format, but I don't display the role after running exe. What's the reason for this? Can you tell me, please. Thanks!!
@dev_emre3 жыл бұрын
Hello, were you able to solve the problem?
@okandemirkaya90663 жыл бұрын
@@dev_emre Emre, kullandıgın versiyon ve assetbundledan dolayı olabilir problemin. Tam olarak ne sorunu alıyorsun
@dev_emre3 жыл бұрын
@@okandemirkaya9066 Problemim tam olarak şöyleydi, PC editörde her şey gayet sağlıklı çalışıyordu fakat IOS build aldıktan sonra telefonda karakterlerim render olmuyordu. "LoadAnimationAssetBundle" IEnumerator 'ını awake fonksiyonunda çağırarak problemi çözdüm şuan problemsiz çalışıyor.
@okandemirkaya90663 жыл бұрын
@@dev_emre Evet ben de o şekilde çözdüm sorunu. Peki sen "Object reference not set to an instance of an object." hatası aldın mı mobilde. Editorde bir sorun yok calısıyor fakat andoridde bu hatayı alıyorum karakteri olusturuyor ama bunda da render etmiyor.
@dev_emre3 жыл бұрын
@@okandemirkaya9066 Hayır öyle bir hata almadım ama benzer bi hata alıyordum şuan tam hatırlayamadım aldığım hatayı ama bundle dosyalarını silip yeniden create edince düzelmişti. Bunu bir dene istersen.
@franciscojoseconesacatala60285 жыл бұрын
Hi Shahin, can I use this method for more than 2k characters? It´s for a football game
@ShahinRostami5 жыл бұрын
Hi Francisco. It depends entirely on the mesh, scripts attached to your characters, materials, etc., and on the minimum requirements for your game... in this video, we went to around 1000 zombies without any issues. In another video (kzbin.info/www/bejne/jXbTgHqOot5lbsU) we go to around 4000 with a different mesh and script. Is this for a stadium audience? There may be more suitable techniques if that's the case. I hope you find the video useful!
@franciscojoseconesacatala60285 жыл бұрын
@@ShahinRostami Hi!! After 1 month it works!! But I have a problem in the building, not showing any issue script on the debugin but doesnt show the geometry, in editor works fine. I tried to check gpu instancing and doesnt work too, help me pls T.T
@ljhoser58423 жыл бұрын
I would recommend using a fake crowd in a football game, most do
@emrekorkmaz51154 жыл бұрын
I get the errors "Assertion failed" and "You should call LoadAnimationAssetBundle first." in android build. How can I fix this? Please help me :)
@okandemirkaya90663 жыл бұрын
Emre merhaba, AssetBundleBrowserı indirip asseti build ettin mi ?
@mooooooon92964 жыл бұрын
Can we use this for AI ? will the colliders still work ? can you explain with more detailed examples like AI.
@lifeartstudios62074 жыл бұрын
I'd like to know as well
@MyChannelWNW714 жыл бұрын
I do everything as shown. My characters are textureless even thou there is a texture .png set in material (shader set the same as tutorial shows). In play mode those characters are totally invisible
@trash2treasure7863 жыл бұрын
me too
@stuartrichards543 жыл бұрын
@@trash2treasure786 me 3
@tenpen74 жыл бұрын
When I press Generate in the Animation Instancing window, it creates a clone of my character, but then just sits there with no indication that it's doing anything, I dont get an Animation Textures folder, how long does the generation process usually take?
@tenpen74 жыл бұрын
Its because my anim controller uses animation blending and I dont think instancing likes those kinds of transitions
@tenpen74 жыл бұрын
Now it works but i went from 25 fps using only CPU instancing, to like 3 fps using animation batching, everything seems to be working correctly as the current number of batches has been dramatically reduced. Any reason this could be having an adverse affect on performance?
@luiginicastro11013 жыл бұрын
@@tenpen7 I'm having the same issue, how did you solve it?
@tenpen73 жыл бұрын
@@luiginicastro1101 I forget exactly what I did as it was over a year ago at this point, now I use a gpu instancer that I got from the asset store that does everything I need
@luiginicastro11013 жыл бұрын
@@tenpen7 Thanks for getting back to me! I found another model that worked, so it must have been something wrong with that one model
@kameleonmedia5 жыл бұрын
i've try everything, it's always invisible. I'm in android and i've updated the code correctly to load assetBundle first... i got no error but the caracter is invisible (in editor). Didnt test yet on android. Any help ? using latest unity 2019
@ShahinRostami5 жыл бұрын
I haven't tested it yet in Unity 2019 myself, but an invisible model usually means you haven't selected one of the shaders that come with the animation instancing package. Hope it works out.
@stuartrichards543 жыл бұрын
Did you ever find a solution?
@KimboKG145 жыл бұрын
took me some time to find this tutorial but it was absolutely worth it!!!! In wich realm of unity are we working once we hit play? is it classic gameObjects or Entities?
@ShahinRostami5 жыл бұрын
I would need to check the AnimationInstancing source code but as a guess, classic gameObjects! I’m glad the video was useful :)
@nv72872 жыл бұрын
excellent tutorial!
@shawarmagames16895 жыл бұрын
Exactly what I needed. Great tutorial. Thank you for copy pasting 1000s of zombies though. :/
@roxannafabiolastefaniuc36063 жыл бұрын
Hey guys!! Maybe someone can see my post and reply ... I cant find animation instancing in add component, from there I am stuck... Do you know why? :s
@roxannafabiolastefaniuc36063 жыл бұрын
nevermind, found the script ;)
@monhasermusic1138 Жыл бұрын
عالی
@paulbunyangonewild75962 жыл бұрын
Ew, this model has Mario 64 limbs, with skinned mesh renderers, yuck 🤮. Precious draw calls wasted on a cool but unnecessary and easily better replicable effect. It's probably done that way to enable limb detachment, but by scaling the bones down to zero and spawning in a low poly regular mesh, maybe a few decals and overlays for added gore, and you got a more involved but likely more performant effect.
@luiginicastro11013 жыл бұрын
When I go to generate the Animation Instancing on my model I get this error: IndexOutOfRangeException: Index was outside the bounds of the array. AnimationInstancing.AnimationGenerator.BakeWithAnimator () (at Assets/AniInstancing/Editor/AnimationGenerator.cs:514) AnimationInstancing.AnimationGenerator.OnGUI () (at Assets/AniInstancing/Editor/AnimationGenerator.cs:330) Any thoughts?