Expand description
Unity TypeTree processing module
This module provides comprehensive TypeTree processing capabilities, organized following UnityPy and unity-rs best practices.
§Architecture
The module is organized into several sub-modules:
types- Core data structures (TypeTree, TypeTreeNode, etc.)parser- TypeTree parsing from binary databuilder- TypeTree construction and validationserializer- Object serialization using TypeTree information
§Examples
use unity_asset_binary::typetree::{TypeTreeParser, TypeTreeBuilder, TypeTreeSerializer};
use unity_asset_binary::reader::BinaryReader;
// Create mock data for demonstration
let data = vec![0u8; 100];
let object_data = vec![0u8; 50];
// Parse TypeTree from binary data
let mut reader = BinaryReader::new(&data, unity_asset_binary::reader::ByteOrder::Little);
let tree = TypeTreeParser::from_reader(&mut reader, 19)?;
// Use TypeTree to parse object data
let serializer = TypeTreeSerializer::new(&tree);
let mut object_reader = BinaryReader::new(&object_data, unity_asset_binary::reader::ByteOrder::Little);
let parsed_object = serializer.parse_object(&mut object_reader)?;
// Build TypeTree programmatically
let mut builder = TypeTreeBuilder::new().version(19);
builder.add_simple_node("GameObject".to_string(), "Base".to_string(), -1, 0)?;
let built_tree = builder.build()?;Re-exports§
pub use builder::TypeTreeBuilder;pub use builder::TypeTreeValidator;pub use builder::ValidationReport;pub use parser::ParsingStats;pub use parser::TypeTreeParser;pub use registry::CompositeTypeTreeRegistry;pub use registry::InMemoryTypeTreeRegistry;pub use registry::JsonTypeTreeRegistry;pub use registry::TypeTreeRegistry;pub use serializer::PPtrScanResult;pub use serializer::TypeTreeParseMode;pub use serializer::TypeTreeParseOptions;pub use serializer::TypeTreeParseOutput;pub use serializer::TypeTreeParseWarning;pub use serializer::TypeTreeSerializer;pub use tpk::TpkTypeTreeRegistry;pub use types::TypeInfo;pub use types::TypeRegistry;pub use types::TypeTree;pub use types::TypeTreeNode;pub use types::TypeTreeStatistics;
Modules§
- builder
- TypeTree builder and validation
- parser
- TypeTree parser implementation
- registry
- External TypeTree registry (UnityPy TPK-like fallback).
- serializer
- TypeTree serialization and deserialization
- tpk
- TPK (Type Package) support for external TypeTree registries.
- types
- TypeTree data structures
Structs§
- Type
Tree Info - TypeTree information summary
- Type
Tree Processor - Main TypeTree processing facade
Functions§
- build_
common_ typetree - Build a simple TypeTree for common Unity types
- create_
processor - Convenience functions for common operations Create a TypeTree processor with default settings
- get_
parsing_ method - Get recommended parsing method for Unity version
- get_
typetree_ info - Get TypeTree information summary
- is_
version_ supported - Check if TypeTree format is supported
- parse_
object_ with_ typetree - Parse object using TypeTree
- parse_
typetree - Parse TypeTree from binary data with version detection
- serialize_
object_ with_ typetree - Serialize object using TypeTree
- validate_
typetree - Validate TypeTree structure