diff --git a/UnityPy/helpers/Tpk.py b/UnityPy/helpers/Tpk.py index a636d7d1..e8f53dd4 100644 --- a/UnityPy/helpers/Tpk.py +++ b/UnityPy/helpers/Tpk.py @@ -1,5 +1,6 @@ from __future__ import annotations +import re from enum import IntEnum, IntFlag from importlib.resources import open_binary from io import BytesIO @@ -300,7 +301,11 @@ def fromStream(stream: BytesIO) -> UnityVersion: @staticmethod def fromString(version: str) -> UnityVersion: - return UnityVersion(version.split(".")) + match = re.match(r"(\d+)\.(\d+)\.(\d+)(([a-zA-Z]+)(\d+))?", version) + if not match: + raise ValueError("Invalid version string") + major, minor, patch, _, type, build = match.groups() + return UnityVersion.fromList(int(major), int(minor), int(patch), int(build)) @staticmethod def fromList(