HackingUnity | Useless Game Dev

Поделиться
HTML-код
  • Опубликовано: 20 янв 2025

Комментарии • 88

  • @nolram
    @nolram 2 месяца назад +65

    The reason the empty project is faster is because it’s using different default project settings, not bloat.

    • @uselessgamedev
      @uselessgamedev  2 месяца назад +42

      Yeah it's also something I realized _after_ the video was completed, it might just be because the original one used URP, and Built-in is faster. But apparently it's not, it's due to other project settings. Which leads to the same conclusion of: take the time to tweak your project settings if you want extra performance.

    • @MrAppleGuySnake
      @MrAppleGuySnake 2 месяца назад +2

      ​@@uselessgamedev URP absolutely slows down the editor (not sure about runtime) to an absurd degree. More annoying, it seems related to the inspector so it slows down and speeds up depending on how much you're moving the mouse and what you have selected

    • @TeHzoAr
      @TeHzoAr 2 месяца назад +5

      ​@@uselessgamedev you should probably delete the video

  • @Pitoouuu
    @Pitoouuu 2 месяца назад +24

    5:35 Don't use the FPS as a measurement, use milliseconds per frame. That way, you will see each project got a (very small) boost, like 0.05 ms less per frame.

  • @johnrossporter3439
    @johnrossporter3439 2 месяца назад +45

    Did you know that you can disable many of the default things by going to Package Manager->Built-in?

    • @Drastonar
      @Drastonar 2 месяца назад +1

      This

    • @NeatWolf
      @NeatWolf 2 месяца назад +3

      Came here to say the same after watching 2 minutes - that's...a bit embarrassing ^^"

  • @CelesteSoueid
    @CelesteSoueid 2 месяца назад +11

    Here's one that, in my tests, gave an 8x improvement in frame-time: avoid using unity's reflection-based "event" functions (eg. Start, Awake, Update, FixedUpdate). If you create a singleton that receives the unity "events", you can architect your MonoBehaviours (via base class) to register and deregister themselves to the singleton, which will then directly call the relevant methods through either C# events, or lists of interfaces (eg. IFixedUpdateable, IAwakeable).
    I don't use Unity nowadays, so unfortunately I didn't get much use out of this after I figured it out, but hopefully it helps others. Unity's 'events'/'messages' are based on runtime reflection, which comes with an absolutely insane amount of overhead. I've never understood why they thought building the application code on the top of reflection was a good idea, especially since when they first architected it, reflection was even slower than it is now.

    • @uselessgamedev
      @uselessgamedev  2 месяца назад +3

      Oh 100%. You could even put your singleton in the playerloop. But it's certain the SendMessage/Broadcast message system is a performance sinkhole, and the events (Update etc) cannot be much better

    • @Biggorbino
      @Biggorbino 2 месяца назад +2

      Hi, could you try explaining that in a beginner friendly way because i am interested

    • @Briezar
      @Briezar Месяц назад

      from what I know, Unity messages do not use reflection (SendMessage might be, but not Start, Update, etc.). A quick search on google will have you this:
      "The first time a MonoBehaviour of a given type is accessed the underlying script is inspected through scripting runtime (either Mono or IL2CPP) whether it has any magic methods defined and this information is cached. If a MonoBehaviour has a specific method it is added to a proper list, for example if a script has Update method defined it is added to a list of scripts which need to be updated every frame. During the game Unity just iterates through these lists and executes methods from it."
      So what you're doing is essentially reinventing the wheel, minus the checks so you have more performance. Checks here include the auto-removal of null/invalid "IUpdateable"s from a list while iterating, handling exceptions and so on.

    • @razveck
      @razveck Месяц назад

      IIRC this is not entirely true. There's a blog post from Unity saying they don't actually call methods through reflection. They register the methods through reflection at compile time/some other pre-processing step and there is no runtime reflection.

  • @SkylorBeck
    @SkylorBeck 2 месяца назад +53

    I turned on Managed Code Stripping and cut my build size by 2mb 😎

  • @Parpious
    @Parpious 2 месяца назад +11

    bro breaking the unity of unity

  • @dawidmx
    @dawidmx 2 месяца назад +5

    You can also change compression settings for smaller build size.

  • @PoisonedAl
    @PoisonedAl 2 месяца назад +21

    Why is your project still so large? I got a 3D, first person horror game with sound and music down to 38Mb!

    • @successor0
      @successor0 2 месяца назад +3

      HOW

    • @PoisonedAl
      @PoisonedAl 2 месяца назад +7

      @@successor0 Leaning on a style using low poly and a few basic textures run through a shader.

    • @joaopedromonteiro2517
      @joaopedromonteiro2517 2 месяца назад

      He probably didnt compress the textures

    • @gorlix
      @gorlix 2 месяца назад

      ​@@successor0also check build logs it shows which assets have which size consumption

    • @surdno5796
      @surdno5796 2 месяца назад +3

      Unity Player alone is >30mb. All your assets, scenes, resources and managed libraries fit into 8MB? Bullshit.

  • @naramoro
    @naramoro 2 месяца назад +8

    I like the *foreshadowing*

  • @empty5013
    @empty5013 2 месяца назад

    loving this video but a minor gripe: measure performance in ms, not fps, fps is hard to compare due to being inverse. if you cut frame time by 16ms you go from 30fps to 60, or from 10 fps to 13fps, same improvement but one seems way more impressive!!
    gamers might not understand ms vs fps but we're smart game devs so we don't need to worry about that for performance discussion

  • @albarnie1168
    @albarnie1168 2 месяца назад +4

    False advertising. this is Useful game dev.

  • @imzary
    @imzary 2 месяца назад +19

    Honestly? Unity's issue is not really that it's builded games are bloated, rather the editor itself is.
    God unity 2022 LTS was an absolute PAIN to use, Unity 6 is miles faster in that regard but still slower than the old days of unity 2018 & 2019

    • @uselessgamedev
      @uselessgamedev  2 месяца назад +6

      Yeah I look forward to the switch to coreCLR I think it will vastly improve performance

    • @CadaverKuma
      @CadaverKuma 2 месяца назад

      Unity 2020-21 is the fastest

  • @neonneon892
    @neonneon892 2 месяца назад

    Unfortunate how all game engines just seem to get bigger over time. I just checked the size of a game jam game I made in 2017 with Unity, and that was 39MB without paying any attention to the size of the project. And it had 3D graphics, unlike the project in this video.

  • @maxlabsinc1662
    @maxlabsinc1662 2 месяца назад +2

    Could you use Project Tiny / DOTS runtime? I’ve never used it, but it might be an improvement.

    • @uselessgamedev
      @uselessgamedev  2 месяца назад +2

      Isn't project Tiny discontinued? If not, that would be a great lead for a new default template

    • @ITR
      @ITR 2 месяца назад +1

      ​​@@uselessgamedevTiny turned into DOTS, but it's not tinying the same way

  • @tommcboatface1908
    @tommcboatface1908 2 месяца назад +1

    As a gamedev myself, I love your channel!

  • @viccie211
    @viccie211 2 месяца назад +1

    As a full time C# web dev. JetBrains Rider is AWESOME! it's great seeing them sponsor youtubers

  • @Cyberfoxxy
    @Cyberfoxxy Месяц назад

    A blank project should be about 30mb. Surely your couple of images can't bump it to 80mb!
    This is why I have settled on older versions of Unity. They provide negative value with each update. I clearly remember going from Unity2019 to Unity2021 in-editor compile times went from ~1 second to 3-5 seconds.

  • @surdno5796
    @surdno5796 Месяц назад

    I wonder if we can dnSpy-hack the game to exclude the unnecessary code in build.

  • @anon_y_mousse
    @anon_y_mousse 2 месяца назад

    I'd love to see a whole series on this with at least one video for every engine. Might be really cool to write an engine from scratch and talk about the best ways to optimize it.

    • @sechmascm
      @sechmascm Месяц назад

      The most optimized game engine is the one made for that one specific game. You only add what you want/need

    • @anon_y_mousse
      @anon_y_mousse Месяц назад

      @@sechmascm If you don't enjoy programming then fine, but some people do.

    • @sechmascm
      @sechmascm Месяц назад

      @@anon_y_mousse What are you on about? lol I was saying that you have to make your own engine... I don't follow your logic

    • @anon_y_mousse
      @anon_y_mousse Месяц назад

      @@sechmascm Do you enjoy writing boilerplate code that you have already written over and over again? Even if you write an engine generically, you'll just be duplicating the preexisting engines. Better to just start writing your game, unless you're only doing it for a learning experience.

    • @sechmascm
      @sechmascm Месяц назад

      @@anon_y_mousse Well, you can start from the step just below the comercial engines. No need to write a compiler from scratch, but there are existing libraries that give you control over what you want to add. I'm not even an engine purist, but if you want a comercial engine to be perfectly optimized for your project it'll be hard to find one. I know you can modify and recompile Godot (if you know C++), but Unity and Unreal Engine could be lost cases in that regard. The tech debt will carry over no matter what

  • @empty5013
    @empty5013 2 месяца назад +4

    unsubscribed this is useful game dev

  • @fakeusertas721
    @fakeusertas721 2 месяца назад

    Source Code (this code only for free share can be possible) ??

  • @sketchingbaer8243
    @sketchingbaer8243 2 месяца назад

    there is (or was?) a light version. i dunno how to find it, but it was presented some time ago. they marketed it for mobile games, that want to be as small as possible, only using the bare minimum

    • @uselessgamedev
      @uselessgamedev  2 месяца назад

      Project Tiny it was called. I don't know if it's officially canceled but the package doesn't get a lot of activity these days

  • @garklein8089
    @garklein8089 2 месяца назад

    What is that background? It looks really cool!

    • @uselessgamedev
      @uselessgamedev  2 месяца назад

      It's three sobel filters applied to a two sliding gradient noises multiplied together

  • @julienpoulton4924
    @julienpoulton4924 2 месяца назад

    did you know running a baguette through a vampire's heart is a painstaking process?

  • @pokruk0
    @pokruk0 2 месяца назад

    Premature optimization moment

  • @ChillaxeMake
    @ChillaxeMake 2 месяца назад

    A lot of people are just considering ditching Unity entirely.

    • @CadaverKuma
      @CadaverKuma 2 месяца назад

      A gazillion quadrillion of a billion people are considering leaving unity 🤯 🤯

  • @psenej
    @psenej 2 месяца назад +1

    I m french and je valide la baguette

  • @cd2028
    @cd2028 2 месяца назад +1

    Great video! Didn't jetbrains have a malware or keylogger controversy a while back?

    • @eemstar5364
      @eemstar5364 2 месяца назад +7

      no

    • @celdaemon
      @celdaemon 2 месяца назад +6

      no they did not

    • @needleful
      @needleful 2 месяца назад

      From looking it up, it sounds like Russian hackers tried to exploit older versions of JetBrains, but I don't see much else.

    • @reverseturingtest
      @reverseturingtest 2 месяца назад +7

      The only thing I can find is an APT attacking some CI/CD servers running JetBrains' TeamCity, and a Trojan allegedly being distributed disguised as a crack for JetBrains IDEs. I don't think either is really of great concern for the everyday developer?

    • @TechnicJelle
      @TechnicJelle 2 месяца назад

      what????

  • @Uforik64yt
    @Uforik64yt 2 месяца назад +2

    You would love Godot!

    • @igorthelight
      @igorthelight 2 месяца назад

      Agree!
      But for build sizes. Defold and GameMaker Studio 2 are even better ;-)
      Godot export templates could be rebuilded with less modules tho - still not as small as Defold and GMS2 xD

    • @sechmascm
      @sechmascm Месяц назад

      ​@@igorthelightyou can strip editor features you don't need from the editor settings as well

  • @pokefreak2112
    @pokefreak2112 2 месяца назад +6

    man unity is so cooked, I remember back in the day before all this modular subsystem bs there was just a single unity runtime dll and a build would be like 15mb total

    • @CadaverKuma
      @CadaverKuma 2 месяца назад

      Its not BS my man, they don’t appeal to you, then aight, don’t use it…

    • @pokefreak2112
      @pokefreak2112 2 месяца назад

      @CadaverKuma The entire point of a package system is that you can have a lean core and only include modules you need. But instead of getting leaner Unity just got slower and more bloated, that's just objectively a failure. Doesn't mean it can't still be the best engine for your usecase of course, but I think the drastic decline in popularity and share price proves I'm not alone in thinking Unity messed up.

    • @pokefreak2112
      @pokefreak2112 2 месяца назад

      @CadaverKuma Also apparently project tiny is _still_ in preview lmao, so that isn't even an option. I used Unity for 8-ish years and in that time they've *always* over promised and under delivered.

    • @CadaverKuma
      @CadaverKuma 2 месяца назад

      @@pokefreak2112 always bringing up the price changes from over a year ago 😭.. brother, the whole team changed from the board to the ceo

    • @autismspirit
      @autismspirit Месяц назад

      @@pokefreak2112 The planned switch to CoreCLR is hopefully gonna speed it back up to the levels of Unity 5. Probably gonna be in a beta next year or something

  • @JamieBainbridge
    @JamieBainbridge 2 месяца назад

    Later, the govt made Baguette Clicker the French national video game. Congratulations! 🎉🇫🇷🥖

    • @uselessgamedev
      @uselessgamedev  2 месяца назад +1

      The original title I planned was _Paintastic_ but I couldn't be bothered to make a visual for it

  • @NeatWolf
    @NeatWolf 2 месяца назад

    Or, you know, just uninstall the built-in features you don't use from the package manager 😜
    I appreciate the effort tho ^^

  • @thanatosor
    @thanatosor 2 месяца назад

    This is hopeless 😂
    Just try defold if you want 5MB build size

  • @reguret2976
    @reguret2976 2 месяца назад

    boids!

  • @kaasronald3623
    @kaasronald3623 2 месяца назад

    all your videos are good

  • @tommax1626
    @tommax1626 2 месяца назад

    Hey, Nice!!!

  • @WeekofRain_hr
    @WeekofRain_hr 2 месяца назад

    useless game dev? all i see are gold

  • @KingRecycle69
    @KingRecycle69 2 месяца назад

    You can edit the manifest file to include only the packages you want. Its just a json file so you can save it and every new project you just replace it with your edited one and unity will automatically add and remove packages.