Skip to content

Commit 8d56bf4

Browse files
committed
chore(ObjectReader): add modern save alias
1 parent f6b4ef8 commit 8d56bf4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

UnityPy/files/ObjectReader.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,15 @@ def parse_as_object(self, node: Optional[NodeInput] = None, check_read: bool = T
294294
def parse_as_dict(self, node: Optional[NodeInput] = None, check_read: bool = True) -> dict[str, Any]:
295295
return self.read_typetree(nodes=node, wrap=False, check_read=check_read) # type: ignore
296296

297+
def patch(
298+
self,
299+
obj: Union[dict, T],
300+
nodes: Optional[NodeInput] = None,
301+
writer: Optional[EndianBinaryWriter] = None,
302+
):
303+
return self.save_typetree(obj, nodes=nodes, writer=writer)
304+
305+
# MonoBehaviour specific methods
297306
def parse_monobehaviour_head(self, mb_node: Optional[TypeTreeNode] = None) -> MonoBehaviour:
298307
if mb_node is None:
299308
mb_node = get_typetree_node(ClassIDType.MonoBehaviour, self.version)

0 commit comments

Comments
 (0)