man, that was excellent. i was completely lost with the profiler, but you gave the right priorities conceirning performance monitoring. infinite thanks for sharing
As someone who considers themselves good at optimization I think these pointers are really good! The other thing not mentioned is an object pooling system.
Great tips! I think a more general way to summarize some points is to "offload work from the cpu to the gpu", or even more general "parallelize processes where possible", for example by using the job system or shaders. With the parallel nature of how shaders are run, it should be more performant in most cases. For example, recently I implemented a simple ongoing auto rotation for meshes in a shader instead of in MonoBehaviours and Update() - for collectible objects in a game. A few years back I tried the Animation Instancing repository from Unity too, and I got it to work but it take a while and some trial and error. There are youtube videos from someone called "Dr. Shahin Rostami" who covers them a little more into detail and I think there was a talk on it somewhere as well (not sure if it was a Unite talk) - those helped me too, for understanding and implementation
True. In general most optimizations I apply fall into about 3 categories: 1. Parallelize the work. 2. Pre compute the work and use the pre computed result. 3. Use a less complex algorithm. I appreciate the reference for the Animation Instancing help. I’m sure many people will benefit from that!
when its in therm of mobile games, I aim for it to be able to run at 60fps on a nintendo 3ds which require absolutely incredible optimisation and well designed models and textures as if it runs, it will be able to run at above 60fps on every phones that are 15yo or newer the 3ds having a generally modern arm cpu makes codes that run on it run really well on many arm android devices
I have a couple of tips as well: The Unity animator is incredibly slow. It's easy to animate this way, but you should try to use it sparingly if you can. Especially if there's an animation that's not doing anything. Disable the animator until you're actually running an animation. 3D is faster than 2D. I know this sounds crazy, but 3D physics are actually faster than 2D physics, and doing an unlit/transparent cut out shader on a plane is faster than rendering a 2D sprite. Unity didn't initially have a 2D engine, and when they added it, it seems to have really been done poorly.
05:44 I've always known that skinned mesh renderers impact a huge performance to the game but never knew what's the easiest approach to solve them. I'll definitely try the tool from the asset store. Do you have any tips regarding that tool? P.S Just found out your channel, very underrated!
The tool was very easy to implement and they have pretty good documentation. The only additional tip I have is to NOT use a prefab to generate the animations. Make sure to use the root model asset that has the animations or it won’t generate them correctly!
thanks for the tutorial, topics about optimization are among my favorites. One question, would it be possible to use Ragdoll on characters in conjunction with Animation Instancing?
Unfortunately not easily as far as I know. The only way I know to do that would require you to swap between GPU animated mesh and the ragdoll skinned mesh renderer. That means at the time of the swap you’d have to be able to determine the positions the colliders/rigid bodies would need to be at, set those, then apply forces.
Remember that Unity 5 was released back in 2015 and is no longer supported. Any new projects should be started on a modern LTS release like 2020 or 2021. If you have an old project on Unity5 still you can try to optimize the draw calls by reducing the “Batches” in the profiler
@@LlamAcademy I’m currently using Unity 2020 for some reason, in the game scene tab, when I check the status, the batching always shows 0 and the draw call is not showing either. I have some research online. Some people said it was a bug. Do you know anything about it?
@@aronkan7513 Hmm...nope the only time I have that happen is if I select the SCENE View. Llama Survival is on 2019.4LTS still so I can't say I had a lot of experience with 2020 outside making the tutorials
in mobile build , batches are overrated , though its important but shaders complexity and visual quality are as much important as batches. due to lower ram in mobiles and weak gpu. even reducing to lower batches by combining meshes your ram usage can be double which will effect performance even if you reducing triangles your shader complexity can lower performance . mobile optimization is a headache specially if you want to run on most average mid range device. unlike pc where reducing 50% of batches sometimes give more than 50% of fps. where in mobile its completely different case.