Optimization tips for maximum performance - Part 1 | Unite Now 2020

Sdílet
Vložit
  • čas přidán 29. 08. 2024

Komentáře • 73

  • @janmarcbaniqued7612
    @janmarcbaniqued7612 Před 4 lety +37

    A must watch for every unity game developer! Thank you.

    • @ArturoNereu
      @ArturoNereu Před 4 lety +3

      Thank you for watching, Jan! :)

    • @SestoMazzanti
      @SestoMazzanti Před rokem

      @@ArturoNereu Super util. muchas gracias Arturo!

  • @xdanic3
    @xdanic3 Před 9 měsíci +1

    A note for myself:
    - Functions use the stack, fast, Class instances use the heap, be careful
    - If you have lots of objects, use a scriptable object to save shared properties
    - Choose the correct data structure
    - Use object pooling, decide how big the pool is
    - Properties (those with get and set) have an overhead, prefer just using fields aka variables, as shown here
    - Use the addressable asset system, since the resources folder slown down load time
    - Remove empty events when not using them
    - Activate or instantiate objects after the first frame, sine you might have too much things on start() and awake()
    - 22:33 When you change something using a string, compute the hash
    - Avoid complex hierarchies in your scene tree
    - Disable the accelerometer if not used
    - Move rigid bodies with their methods in fixedUpdate()!
    - Cache your references if you need to use thigns like Find()

  • @unnamer345
    @unnamer345 Před 4 lety +128

    "We add empty functions Start and Update for you - just remove it"
    - Unity

    • @GymCritical
      @GymCritical Před 4 lety +1

      unnamer345 interesting, yes yes 😂

    • @solkar
      @solkar Před 4 lety +7

      And you can make your own template to override that

    • @slowdragon4169
      @slowdragon4169 Před 3 lety +1

      unity just trolling us lol

    • @gazoonman
      @gazoonman Před 2 lety +1

      @@solkar And I have to make my own template every single time whenever I want to update the Unity version

  • @MohammadFaizanKhanJ
    @MohammadFaizanKhanJ Před 4 lety +9

    Never thought that scriptable objects are can be used to save memory. Thank you for your kind effort!

    • @ArturoNereu
      @ArturoNereu Před 4 lety +1

      Thank you! Yes, some of the benefits of SO's.

  • @binarium4376
    @binarium4376 Před 3 lety +2

    UNITY IS GONNA REACH 1M SUBSCRIBERS !

  • @monticelloave5273
    @monticelloave5273 Před 4 lety +7

    T.Y. this what I'm talking about. Useful uploads, big time.

  • @MaharbaRacsoChannel
    @MaharbaRacsoChannel Před 4 lety +32

    Hi. This series is something much needed, thanks a lot. With respect to the recommendation about using preprocessing directives to eliminate properties: I had the notion that this kind of simple properties were inlined by the compiler in non-editor, or at least non-debug, builds. Why do why need to use this kind of tricks? Are this kind of properties not usually inlined? What about using AgressiveInlining with the MethodImpl attribute, would that make them be inlined?

    • @GladerDev
      @GladerDev Před 4 lety +1

      In normal .NET they would be inlined by JIT usually by default. No idea if Unity3D does something terrible such as removing inlining from JIT or something from their customized runtime.

  • @AntonSem
    @AntonSem Před 4 lety +1

    This is a great video! Absolutely everyone who writes code for Unity should watch it!

    • @ArturoNereu
      @ArturoNereu Před 4 lety

      Thanks for your kind words, Anton.

    • @AntonSem
      @AntonSem Před 4 lety

      @@ArturoNereu Thank you for the great video!

  • @fulongfromthegrave
    @fulongfromthegrave Před 4 lety

    A lot of these tips i knew were good practice but i didnt really understand *why* before watching this video. Thank you very much for the presentation 🙏

    • @ArturoNereu
      @ArturoNereu Před 4 lety

      Great to read this! Main goal was to provide a bit of background on possible root of problems. Thanks for watching!

  • @MohammadFaizanKhanJ
    @MohammadFaizanKhanJ Před 4 lety +5

    What a fine explanation of stack and heap memory! Thank you for the good clarification. I m loving it.

  • @KillerMZE
    @KillerMZE Před 3 lety +2

    This is great, thank you for this. Please make more videos focusing on performance

  • @ChaitanyaShah
    @ChaitanyaShah Před 4 lety +9

    Thanks for the video. Would it be possible to share the presentation? There are some really good examples.

    • @ArturoNereu
      @ArturoNereu Před 4 lety +5

      Hello Chaitanya, of course. Here it is: docs.google.com/presentation/d/1A3MQJef-WzH1gE9pYOfQz8SeodBSE2sUJv8b1-PlXCA/edit?usp=sharing

  • @riddheshzaveri8103
    @riddheshzaveri8103 Před 3 lety

    Awesome useful video. Have already watched tons of optimization videos before but some of tips were really new and useful. I need hundreds of such tips xD.

  • @razzraziel
    @razzraziel Před 4 lety +5

    Please do in depth presentation for these with best practices! thank you.

    • @ArturoNereu
      @ArturoNereu Před 4 lety +2

      Thank you! Will work on more in depth content!

  • @jean-michel.houbre
    @jean-michel.houbre Před 4 lety

    Super interesting video.
    Unfortunately, certain subtleties of the English language have left some areas of fog ... This is why I thank you warmly for using a presentation, which made viewing easier.
    I look forward to a sequel.

    • @ArturoNereu
      @ArturoNereu Před 4 lety +2

      Hello Jean-Michel, yes. the subtitles are not the best (they are generated by CZcams I think). Here's the presentation with the notes. Hope it helps docs.google.com/presentation/d/1A3MQJef-WzH1gE9pYOfQz8SeodBSE2sUJv8b1-PlXCA/edit?usp=sharing

    • @jean-michel.houbre
      @jean-michel.houbre Před 4 lety

      @@ArturoNereu Thank you very much for the link, the presentation is more complete than the video. The graphics and audio tips are very interesting.
      I have questions about slide 46 (audio import settings):
      - on the slide, you mention Vorbis for Android: what is it about? To use in priority or not to use?
      - in the notes, a Quick Guide to configure the audio settings is indicated, but I did not find the link. Could you tell me where to find it?

  • @Un4GivNX
    @Un4GivNX Před 4 lety +2

    Good but basic stuff. I'd like to see more advanced tips regarding performances.

  • @roguestargun
    @roguestargun Před 4 lety +2

    Can you guys do one on physics optimization? I can't quite grasp what the performance hit of rotating a rigidbody's transform is.

    • @ArturoNereu
      @ArturoNereu Před 4 lety

      Good idea, physics is a very interesting topic to cover.

  • @puretrack06
    @puretrack06 Před 4 lety +1

    I would like an in depth/ practical example of getter/setter optimization. How much up a real performance boost are we talking? Are we talking better memory management or reduce load?

    • @ArturoNereu
      @ArturoNereu Před 4 lety +1

      It really depends. In most cases the real benefit will be close to zero. But just to provide an answer, the benefit is because without getters/setters you basically avoid calling another function.

  • @abdr.jaouni8102
    @abdr.jaouni8102 Před 4 lety +3

    yes, please !!

  • @colonthree
    @colonthree Před 4 lety +4

    That hashing part caught me offguard. ;w;

    • @ArturoNereu
      @ArturoNereu Před 4 lety

      not sure if that was good or bad :)

  • @Bankoru
    @Bankoru Před 4 lety +2

    While these are very basic tips, I don't quite understand the need for ScriptableObjects in that particular case scenario if you can use static variables. Do static variables make copies of themselves for each instance? Same goes for consts.

    • @ArturoNereu
      @ArturoNereu Před 4 lety +3

      I think that in this case, while static might have the same memory usage, flexibility for changing them is better using SO.

    • @Bankoru
      @Bankoru Před 4 lety

      @@ArturoNereu That didn't even cross my mind, I'm dumb.

    • @roxbantv
      @roxbantv Před rokem

      Yes, performance differences between static and SO is almost zero, check taradev video on this. But SO will allow game designers to easily tweak values, and it will be more easy for the designers to edit values in inspecter.

  • @NeoTalon
    @NeoTalon Před 4 lety +3

    Awesome

  • @AlexisPAUTROT
    @AlexisPAUTROT Před 3 lety

    Is there an overhead of a complex hierarchy even if we don't define a method OnTransformChanged in our components ?
    Isn't the matrix of a Transform flagged for recompute and only recomputed if we access it ?

  • @anmill
    @anmill Před 4 lety

    Thanks a lot, this is fantastic tips!

  • @Sai557
    @Sai557 Před 4 lety +1

    Very useful Thank you!

  • @furkanbaldir
    @furkanbaldir Před rokem

    I have a question about Transforming objects. If our rigidbody is kinematic, which class should I use to change position, Transform or Rigidbody?

  • @RokrMods
    @RokrMods Před 3 lety

    Nice presentation 👍🏾

  • @TheSpacecraftX
    @TheSpacecraftX Před 4 lety +1

    What is addressable assets?

  • @andriypostelzhuk8489
    @andriypostelzhuk8489 Před 4 lety +1

    Why are you using new + destroy functions in GC example? Afaik It is never used this way. This example can confuse new unity learners.

  • @joll98
    @joll98 Před 3 lety

    26:27 so if i want to rotate or move "RootGameObject" then it will affect gameobjecta and gameobjectb right ?

  • @AlexisPAUTROT
    @AlexisPAUTROT Před 3 lety

    Aren't properties with no code automatically optimized by the IL2CPP pass & subsequent C++ optimisation ?

  • @Zakadeja
    @Zakadeja Před 3 lety +4

    Explain that you're a 'game evangelist' to my grandparents. I dare you.

    • @abedmerhi96
      @abedmerhi96 Před 3 lety +1

      Hahahahahahhahahahahahahahah 😅😭😅😂😂🤣🤣🤣 u left me dead .

    • @ShatabdaRoy115
      @ShatabdaRoy115 Před 3 lety

      *Instant slap by grandma*

  • @ayemakegame
    @ayemakegame Před 4 lety +2

    thank

  • @davidffortesmeireles5328
    @davidffortesmeireles5328 Před 4 lety +3

    Nice

  • @SillyMakesVids
    @SillyMakesVids Před 4 lety

    Can we get a summary slide?

    • @ArturoNereu
      @ArturoNereu Před 4 lety +1

      sure, here it is docs.google.com/presentation/d/1A3MQJef-WzH1gE9pYOfQz8SeodBSE2sUJv8b1-PlXCA/edit?usp=sharing

    • @SillyMakesVids
      @SillyMakesVids Před 4 lety +1

      @@ArturoNereu Very helpful!

  • @gower1973
    @gower1973 Před 4 lety

    Is the stack and heap just a logical construct by the operating system or the compiler, because on a hardware level surely all the memory space is the same, their isn’t different types of memory cells in the memory sticks is there?

  • @jasai2021
    @jasai2021 Před 3 lety

    Thxxx

  • @nickplays2022
    @nickplays2022 Před 4 lety +1

    2:06 mounee? What's that?

  • @zarodgaming1844
    @zarodgaming1844 Před rokem

    The second last advice is NOT right.
    Sometimes adding and removing a component is THE ONLY WAY to avoid it having an impact on other systems, even when diasabled, EXPECIALLY for a rigidbody!!!
    Absolutely not agree on that 🤔
    ( Maybe to advice having 2 verions of the same object pooled, one with and one without the component .... that is good advice)

  • @ayeshafood9340
    @ayeshafood9340 Před 3 lety

    Nice