Go to file
胡鑫 6478747fb6 fix: TMP textfield typeing 2025-04-01 11:39:01 +08:00
src fix: TMP textfield typeing 2025-04-01 11:39:01 +08:00
unityscripts/Editor feat: include the unity prefab generator 2025-03-30 14:19:17 +08:00
.gitignore feat: loader script & typecheck 2025-03-30 14:16:06 +08:00
package-lock.json fix: dep and puer 2025-04-01 11:14:24 +08:00
package.json fix: dep and puer 2025-04-01 11:14:24 +08:00
readme.md rsconfig & gen 2025-03-30 12:36:13 +08:00
rspack.config.ts fix: dep and puer 2025-04-01 11:14:24 +08:00
tsconfig.json fix: lib 2025-03-30 12:46:56 +08:00

readme.md

Unity Puerts 模板

工作方式

  • 正常npm项目输出一个js bundle与unity独立
  • 依赖Unity生成的类型绑定将打包放入同一目录的Resources文件夹内

安装配置

  • clone本仓库到unity项目外任意路径npm install安装依赖
  • 将Unity项目的Assets/Gen symlink到根目录下
  • 配置.gitignore,忽略Assets/Gen文件夹内容

类型检查

  • 虽然puerts生成的CS.namespace.xxx即使不作额外配置也能用,但没有自动补全

  • 为了使用自动补全,需要额外添加类型标注

    • modules.d.ts中添加:
    declare module "包名" {
      export = CS.包名;
    }
    
    • rspack.config.ts中添加额外的externals:
    externals: {
      "包名": "CS.包名"
    }