Module asset

Module asset 

Source
Expand description

Unity asset processing module

This module provides comprehensive Unity asset processing capabilities, organized following UnityPy and unity-rs best practices.

§Architecture

The module is organized into several sub-modules:

  • header - SerializedFile header parsing and validation
  • types - Core data structures (SerializedType, FileIdentifier, etc.)
  • parser - Main parsing logic for SerializedFile structures

§Examples

use unity_asset_binary::asset::{SerializedFileParser, SerializedFile};

// Parse SerializedFile from binary data
let data = std::fs::read("example.assets")?;
let serialized_file = SerializedFileParser::from_bytes(data)?;

// Access objects and types
println!("Object count: {}", serialized_file.object_count());
println!("Type count: {}", serialized_file.type_count());

// Find specific objects
let textures = serialized_file.objects_of_type(28); // Texture2D

Re-exports§

pub use header::HeaderFormatInfo;
pub use header::HeaderValidation;
pub use header::SerializedFileHeader;
pub use header::validate_header;
pub use parser::FileStatistics;
pub use parser::ParsingStats;
pub use parser::SerializedFile;
pub use parser::SerializedFileParser;
pub use types::FileIdentifier;
pub use types::ObjectInfo;
pub use types::SerializedType;
pub use types::TypeRegistry;

Modules§

class_ids
Unity class ID constants (single source of truth: unity-asset-core) Common Unity class IDs
header
SerializedFile header parsing
parser
SerializedFile parser implementation
types
Asset type definitions

Structs§

AssetFileInfo
Asset file information summary
AssetProcessor
Main asset processing facade
ParsingOptions
Parsing options for different Unity versions

Functions§

create_processor
Convenience functions for common operations Create an asset processor with default settings
get_file_info
Get file information without full parsing
get_parsing_options
Get recommended parsing options for a Unity version
get_supported_versions
Get supported Unity versions
is_valid_serialized_file
Check if a file is a valid Unity SerializedFile
is_version_supported
Check if a Unity version is supported
parse_serialized_file
Parse SerializedFile from binary data
parse_serialized_file_from_path
Parse SerializedFile from file path

Type Aliases§

Asset