Gets the Unity version of the current application.
()
| 73 | |
| 74 | /** Gets the Unity version of the current application. */ |
| 75 | static get unityVersion() { |
| 76 | const get_unityVersion = this.internalCall("UnityEngine.Application::get_unityVersion", "pointer", []); |
| 77 | if (get_unityVersion == null) { |
| 78 | const unityModule = Process.getModuleByName("libunity.so") |
| 79 | const ranges = [...unityModule.enumerateRanges("r--"), Process.getRangeByAddress(unityModule.base)]; |
| 80 | for (const range of ranges) { |
| 81 | const scan = Memory.scanSync(range.base, range.size, "45787065637465642076657273696f6e3a")[0]; |
| 82 | if (scan !== undefined) { |
| 83 | const str = scan.address.readUtf8String() |
| 84 | const matchPattern = /(20\d{2}|\d)\.(\d)\.(\d{1,2})([abcfp]|rc){0,2}\d?/; |
| 85 | const matches = str.match(matchPattern) |
| 86 | console.inform("unity:"+matches ? matches[0] : str) |
| 87 | return matches ? matches[0] : str |
| 88 | |
| 89 | } |
| 90 | } |
| 91 | console.raise("couldn't determine the Unity version, please specify it manually"); |
| 92 | } |
| 93 | return new Il2Cpp.String(get_unityVersion()).content; |
| 94 | } |
| 95 | |
| 96 | |
| 97 | /** @internal */ |
nothing calls this directly
no test coverage detected