pub struct Class {Show 31 fields
pub address: *mut c_void,
pub image: *mut c_void,
pub token: u32,
pub name: String,
pub parent: Option<String>,
pub namespace: String,
pub is_enum: bool,
pub is_generic: bool,
pub is_inflated: bool,
pub is_interface: bool,
pub is_abstract: bool,
pub is_blittable: bool,
pub is_valuetype: bool,
pub flags: i32,
pub rank: i32,
pub instance_size: i32,
pub array_element_size: i32,
pub num_fields_count: usize,
pub enum_basetype: *mut c_void,
pub static_field_data: *mut c_void,
pub assembly_name: String,
pub assembly: Option<Arc<Assembly>>,
pub fields: Vec<Field>,
pub methods: Vec<Method>,
pub properties: Vec<Property>,
pub interfaces: Vec<*mut c_void>,
pub nested_types: Vec<*mut c_void>,
pub element_class: *mut c_void,
pub declaring_type: *mut c_void,
pub ty: *mut c_void,
pub object: *mut c_void,
}Expand description
Hydrated IL2CPP class metadata.
A Class is the main entry point for metadata-driven workflows after
fetching an crate::structs::Assembly from the cache. From here you can
locate methods, fields, properties, create objects, or search for live
instances in the scene.
Fields§
§address: *mut c_voidPointer to the internal IL2CPP class structure
image: *mut c_voidPointer to the image defining this class
token: u32Metadata token for this class
name: StringName of the class
parent: Option<String>Name of the parent class (if any)
namespace: StringNamespace of the class
is_enum: boolWhether the class is an enum
is_generic: boolWhether the class is generic
is_inflated: boolWhether the class is an inflated generic type
is_interface: boolWhether the class is an interface
is_abstract: boolWhether the class is abstract
is_blittable: boolWhether the class is blittable
is_valuetype: boolWhether the class is a value type
flags: i32Flags associated with the class
rank: i32Rank of the class (if array)
instance_size: i32Size of an instance of this class
array_element_size: i32Size of array elements (if this is an array class)
num_fields_count: usizeNumber of fields in this class
enum_basetype: *mut c_voidEnum base type pointer (if this is an enum)
static_field_data: *mut c_voidPointer to static field data
assembly_name: StringName of the assembly defining this class
assembly: Option<Arc<Assembly>>Assembly that this class belongs to
fields: Vec<Field>List of fields in this class
methods: Vec<Method>List of methods in this class
properties: Vec<Property>List of properties in this class
interfaces: Vec<*mut c_void>List of interfaces implemented by this class
nested_types: Vec<*mut c_void>List of nested types within this class
element_class: *mut c_voidElement class (if this is an array class)
declaring_type: *mut c_voidDeclaring type (if this is a nested class)
ty: *mut c_voidPointer to the Type object representing this class
object: *mut c_voidPointer to the System.Type object
Implementations§
Source§impl Class
impl Class
Sourcepub fn dump_string(&self) -> String
pub fn dump_string(&self) -> String
Generates a string representation of the class, including fields and methods
§Returns
String- The formatted string dump of the class
Sourcepub fn create_instance(&self) -> Result<Object, String>
pub fn create_instance(&self) -> Result<Object, String>
Creates a managed instance using System.Activator.CreateInstance.
Use this when you want constructor semantics rather than raw allocation.
Sourcepub fn new_object(&self) -> Result<Object, String>
pub fn new_object(&self) -> Result<Object, String>
Allocates a new object of this class via il2cpp_object_new.
This is the low-level allocation path and does not imply constructor execution.
Sourcepub fn create_scriptable_instance(&self) -> Result<Object, String>
pub fn create_scriptable_instance(&self) -> Result<Object, String>
Creates a ScriptableObject instance of this class.
Sourcepub fn find_objects_of_type(&self, include_inactive: bool) -> Vec<Object>
pub fn find_objects_of_type(&self, include_inactive: bool) -> Vec<Object>
Finds live objects of this type in the scene.
This wraps UnityEngine.Object.FindObjectsOfType and returns bound
Object wrappers for each match.
Sourcepub fn method<S: MethodSelector>(&self, selector: S) -> Option<Method>
pub fn method<S: MethodSelector>(&self, selector: S) -> Option<Method>
Finds a method in this class or its parent chain.
Selectors may match by name, by name plus parameter type names, or by name plus parameter count.
Sourcepub fn field(&self, name: &str) -> Option<Field>
pub fn field(&self, name: &str) -> Option<Field>
Finds a field in this class or its parent chain.
Sourcepub fn property(&self, name: &str) -> Option<Property>
pub fn property(&self, name: &str) -> Option<Property>
Finds a property in this class or its parent chain.
Sourcepub fn init(&self)
pub fn init(&self)
Initializes the class if it hasn’t been initialized yet
Calls il2cpp_runtime_class_init.