Let Talk Asset Tracking

Forum posted on

Project: Armament

In the game I would like us to build a list of asset that are used.  I mean everything, every single asset that we use in Unity in the game.  Does anyone know how to make this functionality?  So we can see what asset we have that we are currently using that is in the isgameable folder?

My thought is to make it apart of the action que but that only get the asset we use in game.  I want a list of every single asset we create from PNG to FBX that is not a Unity file.

Anyone have any thoughts on this?  Maybe we should ask this on the Unity site?

Thanks,
James Fleming 
Facebook
Discord
Let Talk Asset Tracking

538.05 SSgt Anthony Michelizzi Programmer
3/13/2018 9:26:48 PM
I have no experience in this aspect of it. I can't think of a way off the top of my head to do this.
GameProgrammer  - Anthony Michelizzi

Ok I'm going to turn this into a forum post on Unity.  Once I have something I'll post here.

Thanks,
James Fleming 
Facebook
Discord

119.03 Cpl Wallace Donegan Programmer
3/13/2018 11:22:00 PM
I don't know how to keep track of it myself for to view how unity keeps track of it, but from my understanding, only assets that are used in-game are packaged at the time of building. That means unity is keeping track. The question is how to gain access to that information.

In Xenko I counted all the asset in the scene and put it on the screen so I know how many I was using so this code below might do that for us.  Not sure if it will pick up GUI elements too thought.  I just want the asset that we use in the IsGameable folder so I can see what we are using and what we are not using.

UnityEngine.Object.FindObjectsOfType<GameObject>()

Thanks,
James Fleming 
Facebook
Discord

538.05 SSgt Anthony Michelizzi Programmer
3/14/2018 9:20:45 AM
iirc, FindObjectsOfType only gets ones in the active scene. Which means they would have to be active in the scene. I could be wrong though.

GameProgrammer  - Anthony Michelizzi

Yea but if we created like and XML for the game sooner or later we would get a list of each asset etc in debug mode only.  This would allow us to cut dead weight off the project when needed.  Asset get forgot about :( like lost kittens.

Thanks,
James Fleming 
Facebook
Discord

538.05 SSgt Anthony Michelizzi Programmer
3/14/2018 9:54:10 AM

@James

I have a script that handles it (I think) It's currently running and seems to be doing fine.

I'll sync it up with you when it's done running.


GameProgrammer  - Anthony Michelizzi

Ok and then I found this too so I'm make creating the functionality for XML agenda too.

https://www.youtube.com/watch?v=nYWlB7HRNSE

Thanks,
James Fleming 
Facebook
Discord

538.05 SSgt Anthony Michelizzi Programmer
3/14/2018 5:33:10 PM

So the utility I have works as far as I can tell. The list of unused assets didn't include two assets I know I did use. So there is some validation.

Also while it was running, I noticed it found a reference to a texture I used.

asset tracking

asset tracking

There's it running and where it found the two assets I used and how they are used. It also checks for prefabs created that it cant find as well. So if someone does make a prefab out of an asset, and it ends up unused, you can track that too.

I'm running a scan over all the branches to see if you can get a generalized list.


GameProgrammer  - Anthony Michelizzi

Well done that will be a slick utility for us to track our isgameable stuff.

Awesome Sauce

Thanks,
James Fleming 
Facebook
Discord

538.05 SSgt Anthony Michelizzi Programmer
3/14/2018 6:13:04 PM

It worked for the two branches I have opened in unity. Seems you'll have to actually have opened the projects for it to work, but it does work

It's checked in at the root of the project with the PreBuildClean Utility 


GameProgrammer  - Anthony Michelizzi

Anthony that is pretty awesome, looks like its working for the intended functionality. I assume this is mainly to keep the MCU from having to transfer huge file structures all the time. But I found this as well and I'm sharing it only because I had mentioned it earlier but wasn't sure until now.  

"Unity strips most unused Assets during the build, so you don’t gain anything by manually removing Assets from the Project. The only Assets that are not removed are scripts (which are generally very small anyway) and Assets in the Resources folder (because Unity can’t determine which of these are needed and which are not). With this in mind, you should make sure that the only Assets in the Resources folder are the ones you need for the game. You might be able to replace Assets in the Resources folder with AssetBundles - this means that Unity loads Assets dynamically, thereby reducing the player size."

That comes from this page in the Unity Manual - Reducing Build Size

Obviously, we still want to keep the project structure clean so that utility is really cool, but as far as actual game builds it won't make much of a difference. The info the utility provides could be super handy for the MCU tool.

I know that was a little off topic to asset tracking, I'm sorry for diverging, I thought it would be relevant.

538.05 SSgt Anthony Michelizzi Programmer
3/14/2018 8:15:10 PM
It doesn't remove anything. It just makes a list of unused assets. This way we can try to use everything and not forget that we might have a particular asset to still use. It's purely an analytical resource.
GameProgrammer  - Anthony Michelizzi

That's actually pretty cool, especially as asset count increases.