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

Поділитися
Вставка
  • Опубліковано 26 вер 2024

КОМЕНТАРІ • 73

  • @janmarcbaniqued7612
    @janmarcbaniqued7612 4 роки тому +37

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

    • @ArturoNereu
      @ArturoNereu 4 роки тому +3

      Thank you for watching, Jan! :)

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

      @@ArturoNereu Super util. muchas gracias Arturo!

  • @unnamer345
    @unnamer345 4 роки тому +128

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

    • @GymCritical
      @GymCritical 4 роки тому +1

      unnamer345 interesting, yes yes 😂

    • @solkar
      @solkar 4 роки тому +7

      And you can make your own template to override that

    • @slowdragon4169
      @slowdragon4169 3 роки тому +1

      unity just trolling us lol

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

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

  • @MaharbaRacsoChannel
    @MaharbaRacsoChannel 4 роки тому +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 4 роки тому +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.

  • @xdanic3
    @xdanic3 10 місяців тому +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()

  • @MohammadFaizanKhanJ
    @MohammadFaizanKhanJ 4 роки тому +9

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

    • @ArturoNereu
      @ArturoNereu 4 роки тому +1

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

  • @monticelloave5273
    @monticelloave5273 4 роки тому +7

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

  • @AntonSem
    @AntonSem 4 роки тому +1

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

    • @ArturoNereu
      @ArturoNereu 4 роки тому

      Thanks for your kind words, Anton.

    • @AntonSem
      @AntonSem 4 роки тому

      @@ArturoNereu Thank you for the great video!

  • @KillerMZE
    @KillerMZE 3 роки тому +2

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

  • @binarium4376
    @binarium4376 3 роки тому +2

    UNITY IS GONNA REACH 1M SUBSCRIBERS !

  • @MohammadFaizanKhanJ
    @MohammadFaizanKhanJ 4 роки тому +5

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

  • @fulongfromthegrave
    @fulongfromthegrave 4 роки тому

    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 4 роки тому

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

  • @riddheshzaveri8103
    @riddheshzaveri8103 3 роки тому

    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 4 роки тому +5

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

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

      Thank you! Will work on more in depth content!

  • @roguestargun
    @roguestargun 4 роки тому +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 4 роки тому

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

  • @ChaitanyaShah
    @ChaitanyaShah 4 роки тому +9

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

    • @ArturoNereu
      @ArturoNereu 4 роки тому +5

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

  • @puretrack06
    @puretrack06 4 роки тому +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 4 роки тому +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 4 роки тому +3

    yes, please !!

  • @jean-michel.houbre
    @jean-michel.houbre 4 роки тому

    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 4 роки тому +2

      Hello Jean-Michel, yes. the subtitles are not the best (they are generated by UA-cam 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 4 роки тому

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

  • @AlexisPAUTROT
    @AlexisPAUTROT 3 роки тому

    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 4 роки тому

    Thanks a lot, this is fantastic tips!

  • @Sai557
    @Sai557 4 роки тому +1

    Very useful Thank you!

  • @Bankoru
    @Bankoru 4 роки тому +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 4 роки тому +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 4 роки тому

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

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

      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.

  • @colonthree
    @colonthree 4 роки тому +4

    That hashing part caught me offguard. ;w;

    • @ArturoNereu
      @ArturoNereu 4 роки тому

      not sure if that was good or bad :)

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

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

  • @NeoTalon
    @NeoTalon 4 роки тому +3

    Awesome

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

    thank

  • @AlexisPAUTROT
    @AlexisPAUTROT 3 роки тому

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

  • @andriypostelzhuk8489
    @andriypostelzhuk8489 4 роки тому +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.

  • @RokrMods
    @RokrMods 3 роки тому

    Nice presentation 👍🏾

  • @joll98
    @joll98 3 роки тому

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

  • @TheSpacecraftX
    @TheSpacecraftX 4 роки тому +1

    What is addressable assets?

  • @davidffortesmeireles5328
    @davidffortesmeireles5328 4 роки тому +3

    Nice

  • @Zakadeja
    @Zakadeja 3 роки тому +4

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

    • @abedmerhi96
      @abedmerhi96 3 роки тому +1

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

    • @ShatabdaRoy115
      @ShatabdaRoy115 3 роки тому

      *Instant slap by grandma*

  • @gower1973
    @gower1973 4 роки тому

    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?

  • @SillyMakesVids
    @SillyMakesVids 4 роки тому

    Can we get a summary slide?

    • @ArturoNereu
      @ArturoNereu 4 роки тому +1

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

    • @SillyMakesVids
      @SillyMakesVids 4 роки тому +1

      @@ArturoNereu Very helpful!

  • @jasai2021
    @jasai2021 4 роки тому

    Thxxx

  • @nickplays2022
    @nickplays2022 4 роки тому +1

    2:06 mounee? What's that?

    • @ArturoNereu
      @ArturoNereu 4 роки тому +1

      Hey, sorry I meant "money".

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

    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)

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

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

  • @ayeshafood9340
    @ayeshafood9340 4 роки тому

    Nice