Search Unity

Question How much RAM does Unity editor take up that will not be relevant in the Build version?

Discussion in 'General Discussion' started by UserNobody, Dec 6, 2022.

  1. UserNobody

    UserNobody

    Joined:
    Oct 3, 2019
    Posts:
    144
    Hello,
    I am working on a game and in my game I have split my map into multiple chunk terrains. The problem is that when I work in Unity my memory usage gradually goes up to almost like 11 to 12GB. I know that Unity terrain takes up a lot of RAM. Cause it has to save a lot of data in memory. And I have 25 terrain chunks. All 1000 by 1000 in size with 1025 heightmap resolution.

    Of course this big RAM usage problem is also partially a result of not yet finished overall optimization, however, how much of that RAM is only relevant for editor?

    Would the build game RAM usage be this high as well or would it decrease? Because as far as I know Unity editor does take up quite a bit of RAM overall.

    Thank you
     
    Last edited: Dec 6, 2022
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,003
    Use the profiler with the build to check actual memory usage.

    You cannot deduce editor memory usage to be a percentage of the build. It doesn‘t work that way at all. Not even roughly. It‘s a different app that does a different task than your game in ways that are optimized for asset import and editing, not playing your game,
     
    MartinTilo and stain2319 like this.
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,620
    If you're worried about build vs. Editor, why not make a build and see what it uses?

    Editor memory usage varies heavily based on what you're using and doing, so it can't easily be answered. As with many things in software dev, you need to test for yourself.
     
    ShilohGames likes this.
  4. ShilohGames

    ShilohGames

    Joined:
    Mar 24, 2014
    Posts:
    3,023
    Resource usage in a build will usually be lower than in the editor. The editor is doing a lot of stuff that is useful to developers but not directly to players. The only way to know the RAM usage in the build is to make the build and then see how much is being used by the build at runtime.

    With a multi chunk terrain, the memory usage may vary a lot at runtime based on where the player is located and how the loading and unloading is configured. With multi terrain, you can load and unload additive scenes at runtime and each of those scenes would have part of the overall terrain. You may even create several different versions of each terrain section. For example, you would have a full detail version when the player is in that section, but lower detail versions when the player is farther away. A city in the far distance might just contain a simple mesh shell of the outside of the city. That same city might have tremendous detail of buildings and objects when the player is in the city.

    Anyway, you have a lot of control over memory usage as a developer when you split a large map into lots of small sections. If the runtime build is using too much memory, you can think about various LOD possibilities at the multi chunk terrain level. First of all, make sure you don't load all of them into memory at the same time, because that defeats the point of breaking the map into sections. Next, decide what you want your loading and unloading rules to be for each section. Then generate each version of each section. And then set up some code to load/unload those based on your goals.