@@ -148,7 +148,7 @@ def UTTCGen_GetClass(src: MonoBehaviour | str) -> Type:
148148 return UTTCG_Classes.get(src, None)
149149
150150T = TypeVar("T")
151- def UTTCGen_AsInstance(cls : Type[T], src: MonoBehaviour | ObjectReader) -> T:
151+ def UTTCGen_AsInstance(cls : Type[T], src: MonoBehaviour | ObjectReader, check_read : bool = True ) -> T:
152152 """Instantiate a class from the typetree definition and the raw data.
153153
154154 In most cases, this is the function you want to use.
@@ -157,13 +157,14 @@ def UTTCGen_AsInstance(cls : Type[T], src: MonoBehaviour | ObjectReader) -> T:
157157 Args:
158158 cls: The class to instantiate. This should be a class that has been decorated with the UTTCGen decorator.
159159 src (MonoBehaviour | ObjectReader): The MonoBehaviour instance or ObjectReader to read from.
160+ check_read (bool): Whether to check if all fields are read. Defaults to True.
160161
161162 Returns:
162163 An instance of the class defined by the typetree.
163164 """
164165 if isinstance(src, MonoBehaviour):
165166 src = src.object_reader
166- raw_def = src.read_typetree(cls.__typetree__, check_read=False )
167+ raw_def = src.read_typetree(cls.__typetree__, check_read=check_read )
167168 instance = cls(object_reader=src, **raw_def)
168169 return instance
169170''' ,
@@ -220,7 +221,6 @@ def translate_name(m_Name: str, **kwargs):
220221from UnityPy import classes as UnityBuiltin
221222from TypeTreeGeneratorAPI import TypeTreeNode
222223from logging import getLogger
223- from coloredlogs import install
224224
225225import os , shutil
226226from typing import Dict , List
0 commit comments