forked from K0lb3/UnityPy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMonoBehaviour.py
More file actions
23 lines (19 loc) · 745 Bytes
/
MonoBehaviour.py
File metadata and controls
23 lines (19 loc) · 745 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from .Behaviour import Behaviour
from .PPtr import PPtr
class MonoBehaviour(Behaviour):
def __init__(self, reader):
super().__init__(reader=reader)
self.script = PPtr(reader)
self.name = reader.read_aligned_string()
if self.assets_file._enable_type_tree:
self.read_type_tree()
self._raw_offset = reader.Position
@property
def raw_data(self) -> bytes:
"""
Reads the undocumentated data following the default init.
This is usefull for classes that are stored via MonoBehaviours.
"""
reader = self.reader
reader.Position = self._raw_offset
return reader.read_bytes(reader.byte_size - (self._raw_offset - reader.byte_start))