Search Unity

How to find dependencies as-in the final build ?

Discussion in 'Editor & General Support' started by Sylafrs, Jun 8, 2018.

  1. Sylafrs

    Sylafrs

    Joined:
    Jun 25, 2013
    Posts:
    66
    Hello,

    I'm trying to make a tool that predicts more/less the size of the final build. (without plugins)

    The goal is to know the assets and its size used for the build without having to make one (I know of the Editor log method, but I want to avoid it).

    My algo is quite simple :

    1 - Get every Resources folder
    (Directory.GetDirectories)

    2 - Get every asset within those folders
    (AssetDatabase.FindAssets / AssetDatabase.GUIDToAssetPath)

    3 - Get every linked scenes
    (EditorBuildSettings.scenes)

    4 - Get the dependencies of those assets (scenes + resources)
    (AssetDatabase.GetDependencies (recursively))

    5 - Get the Guid of those assets and get the size of the file within the Library/metadata folder.
    (AssetDatabase.AssetPathToGUID / FileInfo)

    I give you the code of my window : https://pastebin.com/2MUpsPYR

    The problem is that when I look at the Editor open log : there are less elements than in my list.
    Sizes are correct, I think that everything is in my list, but there more elements into it..

    For example, I can see Specular textures that aren't used in the final build (21+ MiB)
    (Mio == MiB; kio == kiB; asn..)

    Do you have an idea ?

    Thanks in advance :p
    Sylafrs
     
    Oneiros90 likes this.
  2. Sylafrs

    Sylafrs

    Joined:
    Jun 25, 2013
    Posts:
    66
    Oh I think I got a lead !

    I think the materials we use have changed its shader, but keeps its settings in case we want to set the previous shader back.

    It doesn't clean the material to get the dependencies :/
     
  3. Sylafrs

    Sylafrs

    Joined:
    Jun 25, 2013
    Posts:
    66