Giter Club home page Giter Club logo

asset-bundle-analyzer's Introduction

asset-bundle-analyzer

This tool extracts useful information from Unity asset bundles and stores the information in an SQLite database.

Getting started

You need Python 2.7 to run this program. You will also need a tool such as DB Browser for SQLite to query the database.

This is a command line tool with two mandatory arguments. The first one is the path of the Unity tools folder and the second is the path of the root folder containing the asset bundles to analyze. For example:

python analyzer.py /Applications/Unity/Unity.app/Contents/Tools ~/projects/MyGame/AssetBundles

Note that you must use the same tools that have been used to build the asset bundles, otherwise it will fail.

Optional arguments

  • -p PATTERN, --pattern PATTERN: wildcard pattern used to recursively find asset bundles in the specified folder (default: *)
  • -o OUTPUT, --output OUTPUT: name of the output database file (default: database)
  • -k, --keep-temp: keep the files generated by WebExtract and binary2text in the asset bundle folder (default: False)
  • -r, --store-raw: store raw json objects in 'raw_objects' database table (default: False)

Database structure

The main table is called objects and it contains a row for every object in the asset bundles. It's best to use the object_view view instead because it includes useful information from other tables as well. The primary key is called id and it doesn't represent anything, it's just a unique integer. The natural key would have been the (file, object_id) tuple, but dealing with composite keys complicates all queries so a simpler key is used instead.

The columns in object_view are:

  • object_id: Unity object id
  • bundle: name of the asset bundle containing this object
  • file: name of the file (in the asset bundle) containing this object
  • class_id: Unity class id of that object
  • type: type name
  • name: name of the object, if available (components don't have names)
  • game_object: id of the parent game object, if there's one (components have a parent game object)
  • size: size of the serialized object, before compression (the real size in the asset bundle may be smaller if LZ4 or LZMA compression is used)
  • serialized_fields: the total number of serialized fields of this object

Type-specific views

For some types, there is an additional view with type-specific information:

  • animation_view for AnimationClips: legacy (0 = mecanim, 1 = legacy)
  • audio_clip_view for AudioClips: bits_per_sample, frequency (Hz), channels, type (loading type), format
  • mesh_view for Meshes: indices, vertices, compression (0 = uncompressed, 1 = low, 2 = medium, 3 = high), rw_enabled
  • shader_view for Shaders: counts of properties, sub_shaders and sub_programs
  • texture_view for Texture2D: format, width, height, mip_count, rw_enabled

Additional views

Additional views are also provided:

  • view_breakdown_by_type: total number and total size of all objects per type
  • view_breakdown_shaders: for every shader, the number for instances (> 1 means duplicate), total size and list of asset bundles containing it (separated by line breaks)
  • view_mipmapped_textures: list of all textures with mipmaps, useful to spot UI texture that should not have mipmaps
  • view_potential_duplicates: list of all potentially duplicated objects and in which asset bundles (there may be false positives)
  • view_references_to_default_material: list all game objects having a reference to the default material and indirectly referencing the Default shader
  • view_rw_meshes/textures: list all meshes (or textures) with Read/Write enabled
  • view_suspicious_audio_clips: list all clips that are streamed and should not, or the opposite

asset-bundle-analyzer's People

Contributors

faelenor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.