[中文简体] | [English]
The current page is translated by a machine, information may be missing or inaccurate. If you encounter any problems or have questions, please submit an ISSUE.
- If you are interested in this project, please click
star
to support. - If you have any ideas or questions, please submit feedback through [PR] and [ISSUES].
- Note: The
TsComponent
andThreadWorker
modules in the current project have not been widely verified, and their functionality may have defects. If you encounter any issues during use, please provide feedback through [ISSUES].
- This project is a Unity template project developed based on puerts, using OpenUPM as the default Unity package manager source.
- This project is developed using TypeScript scripts, with runtime support for both
commonjs
andESM
modules (check MixerLoader.Mode for matching rules).- This project supports webgl build (
ESM
). If using webgl build, be sure to first read the article "How to Migrate from the Original PuerTS Project?" in the source repository.- Integrates common configurations or tools (optional), such as ScriptPacker (
script packaging
/compression
/encryption
/verification
) and source-map-support, javascript-obfuscator, etc.For more information, please refer to the [Documentation].
[2023/02/13]
Please note that the latest version1.0.0-rc.1
of webgl-support in OpenUMP does not support automatic appending of suffixes, waiting for subsequent updates.
Main features:
-
TsBehaviour:
Use Unity MonoBehaviour lifecycle methods in TypeScript scripts.
-
TsProperties:
A standalone serialization class used for saving data and attaching UnityEngine.Object objects.
-
TsComponent:
Implementation that combines TsBehaviour and TsProperties, serializing member variables in ts scripts and using Unity lifecycle methods. It manages the lifecycle of ts objects. Allows UGUI events to be bound to ts scripts (UGUI events).
-
ThreadWorker:
Provides
cross-thread
&cross-Puerts.JsEnv instance
interaction (data transmission based on C# types).
Software or Package | Version |
---|---|
Unity | 2019.2.x + |
puerts | 1.4.0 + |
nodejs | unknown |
OpenUPM | Version |
---|---|
puerts | 2.0.2 |
puerts-webgl-support | 2.0.2 |
puerts-commonjs-support | 2.0.1 |
- Download this template project.
- Go to the
projects/TsProject
directory and execute thenpm install
oryarn
command to install dependencies. - Execute the
tsc
command to compile the TypeScript project. - Done.
- ConsoleRedirect:
Implement direct jumping to ts scripts by clicking/double-clicking hyperlinks in the Unity Console.
- HotReload:
C#-only js script hot update tool (requires
v8 + inspect
support), used for runtime modification of js logic for quick debugging. - MiniLinkXml:
Analyze the typescript project, obtain all used C# types (support additional custom types), and generate a minimal
link.xml
configuration file. - ECMAScript:
C# namespace generation tool, can
quick import
values and types (e.g.,import { GameObject} from 'csharp.UnityEngine'
). Make the project compatible with both commonjs and esm modules without additional code modifications.
- None