Jump to content

How could I get rid of Gaia references which are not used anymore?


Matmalm

Recommended Posts

I was doing memory profile and found out that there are many references to Gaia's objects which I don't even use, such as: skyboxes, audio clips, trees, and other assets...

Some are reference to the Scanner (ScannerMaterial), World designer, etc

I deleted some of them, but looking into all of them would take quite a bit of time

Link to comment
Share on other sites

I would start by clearing the project cache. 
Other than that Unity does keep onto a lot of weird things even if an object has never been in a scene but in the project. 
I will have to see what else you can do but I believe the best option is what I mentioned. 

 

Link to comment
Share on other sites

On 10/25/2022 at 7:49 AM, Bryan said:

I would start by clearing the project cache. 
Other than that Unity does keep onto a lot of weird things even if an object has never been in a scene but in the project. 
I will have to see what else you can do but I believe the best option is what I mentioned. 

 

I just deleted the project cache but it didn't help

In this image I have at least 3 files from Gaia which I'm not using for example:

PWmemory.png

 

Happens the same with Gena

Link to comment
Share on other sites

Hi @Matmalm, the files in your screenshot seem to be ground texture files - this is most likely due to a Gaia spawner still being in the scene that references those textures in order to be able to spawn them. Them being referenced in the spawner is enough for them being loaded in memory, even if the texture is not placed on the terrain in the end. 
Note though that the "Gaia Tools" object is set up to use the "Editor Only"-tag - this means everything below the Gaia Tools object should automatically be removed when building your game, so those textures should not be present in a build anymore.
Another source of unwanted references can be the "Scene Profile" stored in the "Gaia Global" script on the object "Gaia Runtime". This scene profile holds all data e.g. for the different lighting or water profiles, and thus also has references to sky boxes. You can see the data it references by switching the inspector in Debug mode:


image.png

Make a backup before you start to edit this file, and then you can e.g. remove references to lighting profiles that you do not use in there to prevent unnecessary files being pulled into the build:

image.png

Link to comment
Share on other sites

6 hours ago, Peter said:

Hi @Matmalm, the files in your screenshot seem to be ground texture files - this is most likely due to a Gaia spawner still being in the scene that references those textures in order to be able to spawn them. Them being referenced in the spawner is enough for them being loaded in memory, even if the texture is not placed on the terrain in the end. 
Note though that the "Gaia Tools" object is set up to use the "Editor Only"-tag - this means everything below the Gaia Tools object should automatically be removed when building your game, so those textures should not be present in a build anymore.
Another source of unwanted references can be the "Scene Profile" stored in the "Gaia Global" script on the object "Gaia Runtime". This scene profile holds all data e.g. for the different lighting or water profiles, and thus also has references to sky boxes. You can see the data it references by switching the inspector in Debug mode:


image.png

Make a backup before you start to edit this file, and then you can e.g. remove references to lighting profiles that you do not use in there to prevent unnecessary files being pulled into the build:

image.png

I cleaned the Scene Profile and got rid of the spawners, however I still have references to assets I don't use

 

referencesgaia.png

Link to comment
Share on other sites

14 minutes ago, Matmalm said:

I cleaned the Scene Profile and got rid of the spawners, however I still have references to assets I don't use

 

referencesgaia.png

 

Hi there is an asset called Asset Hunter pro  I use for stuff like this, it shows anything that is being used and not being used, making a developers life easier, I use it for any single project I used. I used the first version now the second for a long time.. Its on the store and its not expensive.  

 

I use it and recommend it. so I can keep my file sizes down and also clean.  its 40$, on sale about 20$, the fall sale should be coming soon, so you can wait on that too if you like. 

 

I loved it so much, it gave me an idea to make my own in Unreal. 

Link to comment
Share on other sites

3 hours ago, Recon said:

 

Hi there is an asset called Asset Hunter pro  I use for stuff like this, it shows anything that is being used and not being used, making a developers life easier, I use it for any single project I used. I used the first version now the second for a long time.. Its on the store and its not expensive.  

 

I use it and recommend it. so I can keep my file sizes down and also clean.  its 40$, on sale about 20$, the fall sale should be coming soon, so you can wait on that too if you like. 

 

I loved it so much, it gave me an idea to make my own in Unreal. 

The point is to erase the reference, rather than erasing the object in the project. The memory profiler also says that is being used in my application, but I'd prefer to clean all of these references.

 

 

-----------

 

Here I didn't load any terrain, so the list of Gaia's assets is clearer:

 

 

 

gaiareferences2.png

Link to comment
Share on other sites

I deleted the Biomes folder in Gaia and the memory leaking went away.

There was something referencing those spawners in Gaia Settings, but I couldn't figure out what was it, as I cleared it as much as possible. So, the best option was to just get rid of that folder.

Link to comment
Share on other sites

I did an experiment where I created a new scene with a Gaia terrain in it. After removing the Gaia Tools object entirely, I still had those references to the textures as well.
After some experimentation I found that those textures will not immediately be removed from memory, even if they are not referenced in a scene anymore. When closing down the unity editor and loading the scene up again, the textures where gone from memory.
If you are not using the textures (or any of the biome content at all) it might indeed be the better solution to delete the Biome folder overall, this reduces file size of your project as well. If you are using things from the biome folder and you removed unnecessary references from the scene, it might need a restart of the unity editor for that to take effect in the memory profiler in the editor.
Memory usage in a build should not be affected by this, as the textures should not be loaded to begin with if there is no reference left.

Link to comment
Share on other sites

22 hours ago, Matmalm said:

The point is to erase the reference, rather than erasing the object in the project. The memory profiler also says that is being used in my application, but I'd prefer to clean all of these references.

 

 

-----------

 

Here I didn't load any terrain, so the list of Gaia's assets is clearer:

 

 

 

gaiareferences2.png

it does get rid of the reference... lol I know what the point is, not my first rodeo.

 

Which is the most important aspects, if I only needed it to delete it, I would of easily wrote my own script to do it, but Asset Hunter pro,  get rid of references, and any meta left ....  also the library should be rebuild after as well... which is, and should be common practice after wards.

 

You asked for a fast solution, and from my experience, of working with clients, my own projects, this has been a fast solution and dependable.  

 

 

if you don't trust asset hunter pro, use Visual Studio, IDE itself to clean up broken references, after an object was deleted, or unused references, and anything related to references.

 

https://learn.microsoft.com/en-us/visualstudio/ide/troubleshooting-broken-references?view=vs-2022

 

 

 

one of Unity biggest issue, is screwing up references and leaving meta data..  its horrible at cache.. So I been using Asset Hunter pro, for nearly a decade, for various projects, and its the only tool I found to clean a project properly..  Other than using visual studio IDE itself, which is also super powerful, I suggest asset hunter pro, since not everyone is a programmer with in Unity...   but for programmers, VS does the job too...

 

 

Trying to clean cache, fix meta data and refernces by hand, is the worst way to handle this.....  its time consuming.

 

 

 

Back when I worked at the studio, I would get alot of programmers scripts and I would see busted references, where they deleted GO's and so forth..  Pretty common to see this in any engine. Which is why its built into VS IDE, to be able to clean these up.

 

Those are two options  that I use and recommend , or you can try and do it by hand, which is time consuming.   

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...