Created: 3/13/2018 9:17:58 PM
Updated: 3/14/2018 9:36:54 PM
Joined: 2/4/2017
Thread Replies:
15
Thread Followers:
126
Category
Let Talk Asset Tracking
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
Thanks,
James Fleming
Facebook
Discord
Created: 3/14/2018 9:36:54 PM
Updated: 5/9/2018 1:21:20 PM
Joined: 2/13/2018
Member Replies 25
Member Follows 9
That's actually pretty cool, especially as asset count increases.
Created: 3/14/2018 8:15:10 PM
Updated: 10/13/2018 3:04:51 AM
Joined: 10/1/2018
Member Replies 197
Member Follows 63
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.

- Anthony Michelizzi

- Anthony Michelizzi
Created: 3/14/2018 7:47:56 PM
Updated: 5/9/2018 1:21:20 PM
Joined: 2/13/2018
Member Replies 25
Member Follows 9
I know that was a little off topic to asset tracking, I'm sorry for diverging, I thought it would be relevant.
Created: 3/14/2018 7:29:51 PM
Updated: 5/9/2018 1:21:20 PM
Joined: 2/13/2018
Member Replies 25
Member Follows 9
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 SizeObviously, 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.
Created: 3/14/2018 6:13:04 PM
Updated: 10/13/2018 3:04:51 AM
Joined: 10/1/2018
Member Replies 197
Member Follows 63
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

- Anthony Michelizzi

- Anthony Michelizzi
Created: 3/14/2018 5:55:21 PM
Updated: 9/26/2022 7:54:28 PM
Joined: 2/4/2017
Member Replies 748
Member Follows 126
Well done that will be a slick utility for us to track our isgameable stuff.
Awesome Sauce
Thanks,
James Fleming
FacebookDiscord
Thanks,
James Fleming
FacebookDiscord
Created: 3/14/2018 5:33:10 PM
Updated: 10/13/2018 3:04:51 AM
Joined: 10/1/2018
Member Replies 197
Member Follows 63
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.


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.

- Anthony Michelizzi

- Anthony Michelizzi
Created: 3/14/2018 10:20:58 AM
Updated: 9/26/2022 7:54:28 PM
Joined: 2/4/2017
Member Replies 748
Member Follows 126
Created: 3/14/2018 9:54:10 AM
Updated: 10/13/2018 3:04:51 AM
Joined: 10/1/2018
Member Replies 197
Member Follows 63
@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.

- Anthony Michelizzi

- Anthony Michelizzi
Created: 3/14/2018 9:35:54 AM
Updated: 9/26/2022 7:54:28 PM
Joined: 2/4/2017
Member Replies 748
Member Follows 126
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
FacebookDiscord
Thanks,
James Fleming
FacebookDiscord
Created: 3/14/2018 9:20:45 AM
Updated: 10/13/2018 3:04:51 AM
Joined: 10/1/2018
Member Replies 197
Member Follows 63
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.

- Anthony Michelizzi

- Anthony Michelizzi
Created: 3/14/2018 9:14:09 AM
Updated: 9/26/2022 7:54:28 PM
Joined: 2/4/2017
Member Replies 748
Member Follows 126
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
FacebookDiscord
Thanks,
James Fleming
FacebookDiscord
Created: 3/13/2018 11:22:00 PM
Updated: 5/9/2018 1:21:20 PM
Joined: 2/13/2018
Member Replies 25
Member Follows 9
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.
Created: 3/13/2018 9:54:15 PM
Updated: 9/26/2022 7:54:28 PM
Joined: 2/4/2017
Member Replies 748
Member Follows 126
Ok I'm going to turn this into a forum post on Unity. Once I have something I'll post here.
Thanks,
James Fleming
FacebookDiscord
Thanks,
James Fleming
FacebookDiscord
Created: 3/13/2018 9:26:48 PM
Updated: 10/13/2018 3:04:51 AM
Joined: 10/1/2018
Member Replies 197
Member Follows 63
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.

- Anthony Michelizzi

- Anthony Michelizzi