Jump to content

Gaia Pro 2021 Terrain Loader throwing errors among other things (new project)


Cliff

Recommended Posts

I'm not sure if this is a bug, or what's going on, but the terrain loader consistently has been throwing NullReferenceException errors, for no apparent reason whatsoever. I'm 99.99% sure I have the loaders set up correctly, as everything loads, sometimes. It really depends on when I press play what it feels like. Sometimes it will load my terrains perfectly fine. Other times, with no change in settings or the scene mind you, it will load the imposters and regular terrains on top of each other (see image). Other times it doesn't load the terrains at all. Sometimes (only happened once so far fingers crossed), it will stack my terrains on top of each other.

This is a new project, in 2022.3.12. When I make a new scene, and make 4x4 1024 tile map using floating point fix and  splitting the tiles into scenes, everything is fine. Spawn the biome, still good. Add a player to the scene, press play, and from there on out, I get this error:

NullReferenceException: Object reference not set to an instance of an object
Gaia.TerrainScene.UnloadScene (UnityEngine.SceneManagement.Scene scene, System.Boolean& loadRequested, System.Boolean& unLoadRequested, Gaia.LoadState& loadState, System.Boolean isImpostor, System.Boolean bypassTreshold) (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainScene.cs:654)
Gaia.TerrainScene.UpdateLoadState (System.Collections.Generic.List`1[T] referenceList, Gaia.LoadState& loadState, System.Boolean& loadRequested, System.Boolean& unLoadRequested, System.Boolean isImpostor) (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainScene.cs:234)
Gaia.TerrainScene.RemoveAllReferences (System.Boolean forceSceneRemove) (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainScene.cs:107)
Gaia.TerrainLoaderManager.UnloadAll (System.Boolean forceUnload) (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainLoaderManager.cs:1277)
Gaia.TerrainLoaderManager.OnApplicationQuit () (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainLoaderManager.cs:639)

Before it's asked, yes, I do have the floating point fix on the player, as well as a terrain loader set to runtime always. I'm not using the WaitForTerrainLoad as I have my own solution, but the error still happens whether that component is there or not.

 

Other random errors I get depending on the mood of Gaia and unity is as follows:

Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
The following scene GameObjects were found:
Gaia Runtime
 

and:

ArgumentException: The scene is invalid.
UnityEngine.SceneManagement.Scene.GetRootGameObjects (System.Collections.Generic.List`1[T] rootGameObjects) (at <30adf90198bc4c4b83910c6fb1877998>:0)
UnityEngine.SceneManagement.Scene.GetRootGameObjects () (at <30adf90198bc4c4b83910c6fb1877998>:0)
Gaia.TerrainScene.UnloadScene (UnityEngine.SceneManagement.Scene scene, System.Boolean& loadRequested, System.Boolean& unLoadRequested, Gaia.LoadState& loadState, System.Boolean isImpostor, System.Boolean bypassTreshold) (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainScene.cs:617)
Gaia.TerrainScene.ReplaceImpostor () (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainScene.cs:916)
Gaia.TerrainScene.UpdateLoadState (System.Collections.Generic.List`1[T] referenceList, Gaia.LoadState& loadState, System.Boolean& loadRequested, System.Boolean& unLoadRequested, System.Boolean isImpostor) (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainScene.cs:246)
Gaia.TerrainScene.UpdateWithCurrentData () (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainScene.cs:582)
Gaia.TerrainLoaderManager.RefreshTerrainsWithCurrentData () (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainLoaderManager.cs:1249)
Gaia.TerrainLoaderManager.LoadStorageData () (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainLoaderManager.cs:258)
Gaia.TerrainLoaderManager.get_TerrainSceneStorage () (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainLoaderManager.cs:82)
Gaia.TerrainLoaderManager.get_TerrainScenes () (at Assets/Procedural Worlds/Gaia/Scripts/MultiTerrainSystem/TerrainLoaderManager.cs:315)
Gaia.TerrainLoader.UnloadTerrains () (at Assets/Procedural Worlds/Gaia/Gaia Pro/Scripts/MultiTerrainSystem/TerrainLoader.cs:142)
Gaia.TerrainLoader.UpdateTerrains () (at Assets/Procedural Worlds/Gaia/Gaia Pro/Scripts/MultiTerrainSystem/TerrainLoader.cs:170)
Gaia.TerrainLoader.Awake () (at Assets/Procedural Worlds/Gaia/Gaia Pro/Scripts/MultiTerrainSystem/TerrainLoader.cs:133)
 

 

The first two are pretty common occurences, whether it's a new project, new scene, new whatever. Fresh start, still those errors.

 

Also, it's iffy if the floating point fix member is going to work for a gameobject. Sometimes it does and sometimes not. Sometimes it want's to spawn the GO's on a different terrain in the hierarchy. Sometimes it spawns it correctly on the main scene hierarchy like it should.

 

It seems like Gaia Pro 2021 is buggy. At least for me when I'm using it with the bare minimum amount of adding things to a scene, such as standard GO's like a building or two and then everything goes to hell in a hand basket after a play or two. Any ideas of getting this sorted out would be amazing. I was thinking of purchasing Gaia Pro 2023 with my discount to see if these issues went away but if this kind of a thing is going to be prominent no matter what I use, then I don't really want to spend money for more issues. I hope you guys understand that. I just want to find a solution so I can get things moving along instead of troubleshooting the same recurring issue over and over every few minutes.

Thanks a ton in advance!

Screenshot 2023-12-11 013527.png

Link to comment
Share on other sites

And right when I say it only happened once, I hit play again and now I got the terrain stacking. See picture. It's a new issue every time I hit play. Something is pretty wrong here.

Screenshot 2023-12-11 015759.png

Link to comment
Share on other sites

Just closed that play session and went back to the scene view and hit play again and it's back to normal. I hope this gives some insight into what I'm talking about. 

Screenshot 2023-12-11 020028.png

Link to comment
Share on other sites

Hi @Cliff,
I had a look at those errors and it looks like there is an issue with one of the scenes Gaia is loading / unloading:

The two errors:


NullReferenceException: Object reference not set to an instance of an object
Gaia.TerrainScene.UnloadScene

ArgumentException: The scene is invalid.

happens when Gaia is trying to access a scene before it is being unloaded. I could imagine that there is either an issue with the terrain scene data or the scene entries in the build settings, or there is another asset / process interfering and unloading the scene before Gaia is able to.

Depending on what the exact cause of that is, it might explain the other symptoms as well. The "terrain stacking" issue usually happens if there is an error in processing the terrains so they cannot be moved to the correct position in world space according to the current offset for the floating point fix.

Could you please install this patch file? This would add an extra debug entry to the console about which Terrain Scene Gaia tries to unload at that point:

Gaia2021TerrainSceneDebug.zip

You can install the contained .unitypackage file via Assets > Import Package > Custom Package in the editor. After the install you should see the following debug info in the console window:

image.png

When your console is NOT set to "Collapse" mode, looking at this entry before the error is printed in the console would tell which of the terrain scenes is causing this error to appear. My hope is that this provides further info that leads to the "corrupt" terrain scene, or what might be going on.

Link to comment
Share on other sites

I'll give it a shot. The thing is, aside from some house models which is just the standard meshes, materials, textures, I don't have anything installed other than the gaia stuff. I'll see how that goes and see if I can find which terrain tile scene is causing this and post any findings from the console. I'd be interested in finding out why things are getting corrupted when it's about as basic as I can get as far as scene creation that uses floating point fix and terrain loading. Thanks!

Link to comment
Share on other sites

Alright. Got it. So basically what I did, was hit play and then stop and back to the editor a few times and it didn't do it. When I changed the lighting profile from day to morning, or any other such as evening or night, basically anything from what it was set at, it ended up giving me this warning:

Cross scene references are not supported: 'RenderSettings' in scene Terrain_0_1-20231210 - 045535 has an invalid reference to 'Directional Light' in scene Heartheim. This reference will not be saved in the scene.
 

and:

Main Object Name 'Gaia Default Day Post Processing URP' does not match filename 'Terrain_0_1-20231210 - 045535 Gaia Default Day Post Processing URP Profile'
UnityEditor.AssetDatabase:ImportAsset (string)
Gaia.Pipeline.URP.GaiaURPPipelineUtils:CreatePostFXProfileInstance (Gaia.SceneProfile,Gaia.GaiaLightingProfileValues) (at Assets/Procedural Worlds/Gaia/Scripts/Editor/GaiaURPPipelineUtils.cs:542)
Gaia.Pipeline.URP.GaiaURPPipelineUtils:ApplyURPPostProcessing (Gaia.GaiaLightingProfileValues,Gaia.SceneProfile) (at Assets/Procedural Worlds/Gaia/Scripts/Editor/GaiaURPPipelineUtils.cs:418)
Gaia.GaiaLighting:SetupPostProcessing (Gaia.GaiaLightingProfileValues,Gaia.SceneProfile,Gaia.GaiaConstants/EnvironmentRenderer,bool) (at Assets/Procedural Worlds/Gaia/Scripts/Lighting System/Editor/GaiaLighting.cs:1080)
Gaia.GaiaLighting:UpdateGlobalLighting (Gaia.SceneProfile,Gaia.GaiaLightingProfileValues,Gaia.GaiaConstants/EnvironmentRenderer) (at Assets/Procedural Worlds/Gaia/Scripts/Lighting System/Editor/GaiaLighting.cs:219)
Gaia.GaiaLighting:GetProfile (Gaia.SceneProfile,Gaia.Pipeline.UnityPipelineProfile,Gaia.GaiaConstants/EnvironmentRenderer,bool) (at Assets/Procedural Worlds/Gaia/Scripts/Lighting System/Editor/GaiaLighting.cs:102)
Gaia.GaiaLightingEditor:ProfileSettings (bool) (at Assets/Procedural Worlds/Gaia/Scripts/Scene Managment/Editor/GaiaLightingEditor.cs:281)
PWCommon5.EditorUtils:Panel (UnityEngine.GUIContent,string,System.Action`1<bool>,UnityEngine.GUIStyle,bool,bool,bool,UnityEngine.GUILayoutOption[])
PWCommon5.EditorUtils:Panel (UnityEngine.GUIContent,string,System.Action`1<bool>,bool,bool,bool,UnityEngine.GUILayoutOption[])
PWCommon5.EditorUtils:Panel (string,System.Action`1<bool>,bool,bool,bool,UnityEngine.GUILayoutOption[])
Gaia.GaiaLightingEditor:OnInspectorGUI () (at Assets/Procedural Worlds/Gaia/Scripts/Scene Managment/Editor/GaiaLightingEditor.cs:165)
UnityEditor.EditorGUI/PopupCallbackInfo:SetEnumValueDelegate (object,string[],int)
 

So when I fix it (see pic) the terrain manager error is still there and doesn't go away unless I restart unity and then if I change any lighting profile at any time, then I have to go through the process of fixing the post processing volume and all the problems in the original post just start all over again. Surely I should be able to change the lighting profile at any time throughout the design process without having to go through this I would think.

The first img is upon unity start without changing anything and everything loads fine with no errors etc... However upon exiting runtime in the editor, we get the error as seen in the first img.

The 2nd img is after changing the lighting profile and stuff starts breaking.

The 3rd img is showing the 'Gaia Default Day Post Processing URP' profile which I would think should update on all of the terrains when you change the profile throughout the design process. However, it seems like it is not updating all of the terrains like it should, and it's random as to which terrains get updated.

 

Screenshot 2023-12-13 002339.png

Screenshot 2023-12-13 002932.png

Screenshot 2023-12-13 003421.png

Link to comment
Share on other sites

Hi @Cliff,

this is not what I imagined, but still very interesting - both the warnings and your comments sound like there is something unusual going on with the lighting setup in the scene.

You mentioned:

 

Quote

The 3rd img is showing the 'Gaia Default Day Post Processing URP' profile which I would think should update on all of the terrains when you change the profile throughout the design process. However, it seems like it is not updating all of the terrains like it should, and it's random as to which terrains get updated.

Could you please explain a bit more how the lighting setup looks like in your scene? What I find confusing is the "should update on all of the terrains" part. Normally when setting up your lighting with Gaia, it should create one (!) Gaia lighting object in the Main scene that holds references to the profiles. There should be nothing that needs to be updated "on the terrains" when the lighting setup gets changed. Gaia would normally also not create a volume profile that carries the Terrain name like seen in your screenshot, do you know how this file was created?
Could it be that you were applying the lighting setup not only on the main scene, but also on the individual terrain scenes?

For reference, this how the setup in a terrain loading scenario should normally look like, the main scene should hold all the Gaia Tools etc, and the terrain scenes should only hold the terrains + the "regular" game objects placed on them that are part of the map:

image.png

The post processing profile of the main scene should be stored in the Gaia user data with the rest of the session data. There should not be profiles that carry the terrain name:

image.png

If you have multiple lighting setups and especially multiple Terrain Loader manager, or session manager etc. this might explain the problems you were seeing.

Link to comment
Share on other sites

Hi @Peter

I'll attach some screenshots so you can see how it's set up. I don't manually add any of the runtime elements, I let the Gaia Manager take care of all that. So if it's putting it in places it doesn't need to be, Gaia is doing that, not me unfortunately. If I was doing it, it'd be an easy fix lol. But TL:DR, yes there is only one "Gaia Lighting" in the main scene, not on multiple scenes. I do understand that everything should go in the main scene, I've been using Gaia for about 4 years or so now, so for the most part know how everything should be set up thankfully. That's why it was a head scratcher for me when all this started happening on any project I started lol. As far as me saying "should update for all of the terrains for the lighting profile", that was me assuming it assigned or referenced the profile behind the scenes to all of the terrain scenes. I don't really know how Gaia works in the code, I haven't really ever delved that far into it so it was an assumption on my part. Sorry if that caused any confusion.  Anyways, see the screens I have below of how it's all set up.

As far as how the file was created, I have no idea. I didn't create it, so somehow Gaia must have. In the one screenshot, you can see 3 profiles, They are as follows left to right:

Assets/Gaia User Data/Sessions/GS-20231210 - 044832/Scene Profiles/Heartheim Gaia Default Day Post Processing URP Profile.asset

Assets/Gaia User Data/Sessions/GS-20231210 - 044832/Scene Profiles/Terrain_1_1-20231210 - 045535 Gaia Default Day Post Processing URP Profile.asset

Assets/Gaia User Data/Sessions/GS-20231210 - 044832/Scene Profiles/Terrain_2_1-20231210 - 045535 Gaia Default Procedural Post Processing URP Profile.asset

Now looking at those, and I'm not sure so bare with me, but I'm assuming that those are not supposed to be like that? I didn't create any profiles, but it looks like there is multiple for this scene? And that they are referencing terrain scenes for the last 2? And I'm also assuming that the only one that should be there is the first one? Those are my questions. So if that's the case, I'm not sure how and why those other 2 were created that are Terrain_1_1 and Terrain_2_1.

Does that help at all?

Screenshot 2023-12-13 142537.png

Screenshot 2023-12-13 142606.png

Screenshot 2023-12-13 142635.png

Link to comment
Share on other sites

Hi @Cliff thanks for looking into this and providing additional feedback! From the description and the screenshots the setup seems correct. Those profiles named after the terrain chunks are still a bit odd - those should normally not be created by Gaia, but I found a way how it might happen:
If the Gaia Runtime object is deleted from the main scene, then one of the terrain scenes is selected as "Active scene" and then the runtime setup is performed again from the Gaia manager, then the lighting profile is being created with the scene name of that specific chunk. I'm a bit at a loss here because the two original tracks we had (terrain scenes being corrupt / missing, duplicate setup of the terrain loading) turned out to be nothing and I cannot replicate the issues at my end.
Is it possible that you can send me the project so I can have a look? I will send you a link for file upload via DM. If I can get my hands on the project I might have a chance to replicate the issue and then I should be able to debug this to find out what is going on.

Link to comment
Share on other sites

Hey @Peter,

I'm out of town for the holidays, but when I get back, I'll be more than happy to do that for you. Thanks for looking into this as much as you have and Merry Christmas!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...