Search Unity

Addressable Terrain Issues

Discussion in 'Addressables' started by Noogy, Aug 10, 2020.

  1. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hi, I recently adopted Addressables as a means to load scenes. For the most part performance is very good, and implementation is very simple.

    However I'm having issues with Unity terrains. Most of the scenes I'm additively loading contain a terrain, and for some reason these are causing noticeable hitching.

    I've tested loading terrains within scenes with Addressables.LoadSceneAsync and as part of a prefab with Addressables.LoadAssetAsync and get stuttering with both. I don't get any such stuttering with massive amounts of textures or meshes. Even if the terrain is disabled within the scene I get a hitch, or if I'm simply loading it without instantiating within the scene.

    Are terrains just not suitable for addressables? Is there something I'm missing? Tested with 1.8.4 and 1.13.1. Any help would be appreciated, thanks.
     
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,820
    I'll pass this along to the team, and see if they have any insight.
     
    Noogy likes this.
  3. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Hey @Noogy so when you load a scene async the file part of the load has to happen on the main thread. If your terrain is particularly complex or large that could explain the hitching. If you make your Terrain asset Addressable separate from your scene and then instantiate the terrain async after the scene is loaded do you still get the hitching? (I understand this workflow might not be exactly what you're looking for or need. It's just an experiment to explain the hitching).
     
    Noogy likes this.
  4. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hi @DavidUnity3d, thanks for the response. Actually this is the exact solution I ended up with.... load scene via Addressables.LoadSceneAsync, then once I know that's complete load nothing but the terrain via Addressables.InstantiateAsync.

    Interestingly, even with no change the terrain just seemed to hitch things up when being loaded alongside the scene. I even tested scenes that had literally nothing but a terrain element. Terrains just don't seem to like Addressables.LoadSceneAsync.

    I had to drop the terrain complexity to get truly hitchless loading. Right now each terrain has a heightmap res of 1025x1025. I would like to use my originals of 2049 but hitching occurred. Interestingly, having higher resolutions texture resolutions doesn't cause the same issues, I can go pretty high with those, and loading more than one splat per terrain. So I'm guessing it really is about preparing the heightmap data.

    As a last resort I could probably break up each terrain into even smaller chunks, but that's a bit of authoring I'm not ready to commit to yet.
     
  5. Noogy

    Noogy

    Joined:
    May 18, 2014
    Posts:
    132
    Hi all, I'm having a new issue with addressables and terrains (edit, maybe issue found below).

    So previously I had set it up as outlined above, async load a scene, then Addressables.InstantiateAsync a terrain. A little bit of a hassle but it worked fine.

    I recently upgraded to a newer version of Unity and now whenever I attempt to Addressables.InstantiateAsync directly on a terrain asset or Addressables.LoadSceneAsync on a scene containing a terrain asset the Unity editor crashes. Builds also crash in the same way. I'm at a loss here, thanks.

    Unity beta 2020.2.0b8.3329 > 2020.2.21f1

    Edit: So I may have narrowed it down. My master scene contains terrains. I think there might be an issue with the incoming terrains attempting to share IDs and autoconnect to these existing terrains.
     
    Last edited: Feb 1, 2021
  6. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Oof, that sucks you're experiencing crashes. Since you started experiencing the crash after upgrading Unity version it makes me think that something with terrains must have changed that's triggering the issue on the engine side. There could be something Addressables is doing wrong but we shouldn't be causing a crash since packages are all managed code.

    If you don't mind, would you file a bug for this new issue? I bet the terrain team will need to take a look. Sorry for the inconvenience