Top 5 Optimization Tips from Building a Mobile Game in Unity

Поділитися
Вставка
  • Опубліковано 13 лип 2024
  • Learn my top 5 optimization tips from building my latest mobile game! I boosted the fps in my game from barely playable in the Unity Editor to a solid 60fps 🚀 on most mobile devices!
    These are not mobile-specific optimizations, and they don't all apply to every game type. Which optimization techniques will be most impactful for your game will vary depending on what kind of game you're making and how you've implemented it (this is discussed in the video as well).
    If you're struggling with FPS in your game, this is a great starting point for which techniques you can use to optimize your game! There are WAY more than 5 optimization techniques, and not all of them may apply to every game type. These are the ones I found most beneficial when optimizing my game!
    I hope this helps give you some guidance on how you may be able to boost the FPS in your game and have it run super smooth on your target platform and target hardware!
    💸 Ongoing sales 💸
    ⚫ See all active asset sales on the Asset Store: assetstore.unity.com/?on_sale...
    ⚫ Save 25% off your first Asset Store Order: prf.hn/click/camref:1101l9QvC...
    ⚫ Save up to 50% on NEW Assets: assetstore.unity.com/?new_sal...
    👨‍💻 Since this is just a "tips" video, there is no GitHub repository available this time! All tutorials have full projects available on GitHub: www.github.com/llamacademy
    ❤ Believe in LlamAcademy's mission and have received value from the videos? Become a Patreon Supporter or UA-cam Member:
    ⚫ Patreon: / llamacademy
    ⚫ UA-cam Member: / @llamacademy or click the Join button on any video
    📚 Some key resources brought up during the video 📚
    ⚫ Unity Profiler: docs.unity3d.com/Manual/Profi...
    ⚫ Unity Mesh Combining API: docs.unity3d.com/ScriptRefere...
    ⚫ Simple Mesh Combine: assetstore.unity.com/packages...
    ⚫ Unity GPU Instanced Animations: blog.unity.com/technology/ani...
    ⚫ Mesh Animator (no URP / HDRP support): assetstore.unity.com/packages...
    ⚫ Unity Performance Tips: unity.com/how-to/best-practic...
    ⚫ Baked Animations: • Bake Your Animations t...
    ⚫ Static Batching: • Static Batching, Expla...
    ⚫ Jobs System: • Jobs System Line of Si...
    ----
    Most tutorials come from knowledge gained making survival.llama.software Llama Survival - a top-down zombie survival shooter for Android and iOS.
    I also have some Unity Assets (affiliate link): assetstore.unity.com/publishe...
    Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
    #unitytutorial #tutorialtuesday #gamedev #tutorial #unity #llamacademy #gamedevelopment
    Chapters:
    00:00 Topic Introduction
    00:45 Tip 1 - Use the Profiler
    01:50 Tip 2 - Batch, Batch, Batch!
    05:44 Tip 3 - Limit SkinnedMeshRenderers
    08:03 Tip 4 - Use the Jobs System Intelligently
    10:30 Tip 5 - Reduce Complexity of Canvases
    12:03 BONUS TIP - Batch your Canvases
    12:46 Recap & Final Optimization Thoughts

КОМЕНТАРІ • 46

  • @Francisco-Gutierrez
    @Francisco-Gutierrez Рік тому +1

    Super useful, I love your content!

  • @user-fm6pq1fi5j
    @user-fm6pq1fi5j 4 місяці тому +1

    Thanks man, hepful and straight to the point.

  • @flurinjenal374
    @flurinjenal374 4 місяці тому +1

    Thanks for another great performance optimization video!

  • @TChrisBaker
    @TChrisBaker 2 роки тому +6

    Great lesson! This was all 100% new information for me

  • @Pontypants
    @Pontypants 8 місяців тому +1

    Awesome video! Thanks for making this

  • @spiderspyy
    @spiderspyy Рік тому +12

    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.

  • @calvinms7503
    @calvinms7503 Рік тому +1

    THANK YOU!!!!!

  • @Betruet
    @Betruet 2 роки тому

    Thanks mate, that was really helpful.

  • @fmproductions913
    @fmproductions913 2 роки тому +4

    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

    • @LlamAcademy
      @LlamAcademy  2 роки тому +1

      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!

  • @poobagification
    @poobagification 2 роки тому +1

    Excellent stuff. This will be very useful if I ever get the dedication to finish a project.

  • @kotted
    @kotted 2 роки тому +2

    Only 700 views? Huh?! This guy needs more

    • @LlamAcademy
      @LlamAcademy  2 роки тому +1

      Share the knowledge with a friend! 😄

  • @SpeedyGwen
    @SpeedyGwen 2 місяці тому +1

    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

  • @ggshout3019
    @ggshout3019 Рік тому +1

    Simply compressing audio, textures, models and clearing GI Cache reduced loading from 60 sec to 3 and a half.

  • @audemkay
    @audemkay 2 роки тому +4

    Awesome! Optimization is too often overlooked, not just in tutorials but in full released games themselves. Thanks!

  • @P0Omah
    @P0Omah 2 роки тому +1

    Love your videos man, super dense with how much helpful info there is, but never feels overwhelming or dry.

    • @LlamAcademy
      @LlamAcademy  2 роки тому +1

      Thank you 🙏 that means a lot!

  • @AndyLukito
    @AndyLukito 2 роки тому +6

    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!

    • @LlamAcademy
      @LlamAcademy  2 роки тому +4

      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!

  • @Abdulwahab-vb6he
    @Abdulwahab-vb6he Рік тому +1

    amazaing vid brother keep it up.

    • @LlamAcademy
      @LlamAcademy  Рік тому +1

      Thank you, I appreciate that 🙌

  • @dynamicvoltage9765
    @dynamicvoltage9765 2 місяці тому

    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.

  • @quadriproduction
    @quadriproduction 2 роки тому +2

    Great video.Can you make a tutorial for job system and spherecast (using physics in the threads)?would be awsome

    • @LlamAcademy
      @LlamAcademy  2 роки тому +2

      Of course! I’ll put it on the list!

    • @quadriproduction
      @quadriproduction 2 роки тому

      @@LlamAcademy awsome..thank you a lot

  • @ronigleydsonvilasnovas8067
    @ronigleydsonvilasnovas8067 2 роки тому +1

    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?

    • @LlamAcademy
      @LlamAcademy  2 роки тому +1

      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.

    • @ronigleydsonvilasnovas8067
      @ronigleydsonvilasnovas8067 2 роки тому

      thanks man

  • @nabilayyad2550
    @nabilayyad2550 Рік тому

    thanks for the tutorial , its extremely helpful )
    May I ask if you used NavMeshAgent on each of these Zombies ?

    • @LlamAcademy
      @LlamAcademy  Рік тому

      Yes! Each zombie is a NavMeshAgent

  • @Hazzel31337
    @Hazzel31337 Рік тому +1

    nice tips, didnt know the animator has that much coast associated with it

  • @chiragsawajiyani8540
    @chiragsawajiyani8540 2 роки тому +1

    Please make more videos related to mobile game development specially about different controls and swipes etc

    • @LlamAcademy
      @LlamAcademy  2 роки тому

      I’ll add that to my topic list!

  • @MASTONGAMES
    @MASTONGAMES 2 роки тому +2

    too good!

  • @pourmydrank
    @pourmydrank 2 роки тому +1

    Thanks

  • @aronkan7513
    @aronkan7513 2 роки тому

    Hi, an excellent tutorial, just one thing want to mention. In unity 5, you no longer can see the draw call, because they have taken it away

    • @LlamAcademy
      @LlamAcademy  2 роки тому

      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

    • @aronkan7513
      @aronkan7513 2 роки тому

      @@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?

    • @LlamAcademy
      @LlamAcademy  2 роки тому

      @@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

  • @arunachalpradesh399
    @arunachalpradesh399 10 місяців тому

    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.