ts-to-unitycs
raw JSON → 1.0.0 verified Fri May 01 auth: no javascript
A transpiler that converts a TypeScript-like DSL into Unity C# code. Version 1.0.0 – initial release with single-cycle translation, no ongoing maintenance indicated. Differentiates by enabling Unity developers to write game logic in a syntax familiar from TypeScript while generating standard C# scripts for the Unity engine. No release cadence documented; likely a one-off or early-stage tool.
Common errors
error Cannot find module 'ts-to-unitycs' ↓
cause Package not installed or incorrectly referenced.
fix
Run
npm install ts-to-unitycs or add to package.json. error transpile is not a function ↓
cause Incorrect import of the default export as a named import.
fix
Use
import transpile from 'ts-to-unitycs' instead of import { transpile } from 'ts-to-unitycs'. Warnings
breaking The generated C# code may have incomplete syntactic coverage; use with caution. ↓
fix Manually review and adjust output for production use.
gotcha Only a subset of TypeScript features are supported (e.g. no async/await, generics limited). ↓
fix Refer to the documentation for supported features.
gotcha No official tests or CI pipeline; reliability not guaranteed. ↓
fix Contribute tests or use alternative tools.
Install
npm install ts-to-unitycs yarn add ts-to-unitycs pnpm add ts-to-unitycs Imports
- default (transpile function) wrong
const { transpile } = require('ts-to-unitycs')correctimport transpile from 'ts-to-unitycs' - transpile (as function) wrong
import { t } from 'ts-to-unitycs'correctimport t from 'ts-to-unitycs' - TranspilerOptions wrong
import { TranspilerOptions } from 'ts-to-unitycs'correctimport type { TranspilerOptions } from 'ts-to-unitycs'
Quickstart
import transpile from 'ts-to-unitycs';
import { writeFileSync } from 'fs';
const dslCode = `
class PlayerController {
private speed: number = 10;
public Move(direction: Vector3): void {
// translate
}
}`;
try {
const csharpCode: string = transpile(dslCode);
writeFileSync('PlayerController.cs', csharpCode, 'utf8');
console.log('Generated PlayerController.cs');
} catch (err) {
console.error('Transpilation failed:', err);
}