Search Unity

Question How can I access to the "Produced Files/Artifacts" from a script

Discussion in 'Asset Database' started by JuanGuzmanH, Feb 14, 2023.

  1. JuanGuzmanH

    JuanGuzmanH

    Joined:
    Feb 8, 2018
    Posts:
    74
    Hi. Can someone point me in the right direction to have acces (through a script) to the info produced files artifacts associated with an asset?

    I would like to get prety much what the Import activity windows is showing. Artifacts files, path and size.

    Anyone?

    An example will be awesome. Documentation is not givving very much. I think is using
    "AssetDatabase.GlobalArtifactDependencyVersion" but I font know how to use it.
     
  2. Unity_Javier

    Unity_Javier

    Unity Technologies

    Joined:
    Mar 7, 2018
    Posts:
    190
    Hey, maybe this Gist can help: https://gist.github.com/Unity-Javier/a2258b2a542fc61f15d10cd6e83dcefa
    It'll give you the path to the artifacts in the library folder, but then you'll probably need to do a query for the file size (FileInfo in C#).

    One thing to note is that not all import results end up on the Library folder, since import results of directories end up embedded into the ArtifactDB itself (and a couple other file types too), so watch out for paths that start with 'mem:...' when iterating over the paths that AssetDatabaseExperimental.GetArtifactPaths returns :)
     
  3. JuanGuzmanH

    JuanGuzmanH

    Joined:
    Feb 8, 2018
    Posts:
    74
    Gracias Javier! Those gist are gold to me!
     
    Unity_Javier likes this.