npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

unity-types

v6000.5.2

Published

TypeScript definitions for Unity 6000.5

Readme

unity-types

TypeScript definitions for Unity, designed for use with OneJS.

Note: Only Unity 6000.3 and later versions are supported. This build is generated against 6000.5.

Installation

npm install -D unity-types@~6000.5.0

Setup

Add unity-types to your tsconfig.json:

{
  "compilerOptions": {
    "types": ["unity-types"],
    "skipLibCheck": true
  }
}

Note: skipLibCheck: true is recommended. Some C# constructs (like compiler-generated fixed buffers) produce type names that aren't valid TypeScript identifiers.

Or add a triple-slash reference in a global.d.ts file:

/// <reference types="unity-types" />

Usage

The CS namespace is globally available after setup:

// Create a GameObject
const go = new CS.UnityEngine.GameObject("MyObject")

// Access transform
const pos: CS.UnityEngine.Vector3 = go.transform.position
pos.x = 10

// UI Elements
const button = new CS.UnityEngine.UIElements.Button()
button.text = "Click me"

// Physics - generic overloads return the correct type directly
const rb = go.AddComponent(CS.UnityEngine.Rigidbody)  // Type: Rigidbody
rb.mass = 5

// Audio
const audio = go.GetComponent(CS.UnityEngine.AudioSource)  // Type: AudioSource
audio.Play()

// Web requests
const request = CS.UnityEngine.Networking.UnityWebRequest.Get("https://api.example.com")

Included Assemblies

| Assembly | Size | Description | |----------|------|-------------| | UnityEngine.CoreModule | ~1 MB | GameObject, Transform, Vector3, Color, MonoBehaviour, etc. | | UnityEngine.UIElementsModule | ~350 KB | VisualElement, Button, Label, TextField, etc. | | UnityEngine.PhysicsModule | ~88 KB | Rigidbody, Collider, Physics, RaycastHit, etc. | | UnityEngine.Physics2DModule | ~262 KB | Rigidbody2D, Collider2D, Physics2D, etc. | | UnityEngine.AudioModule | ~41 KB | AudioSource, AudioClip, AudioListener, etc. | | UnityEngine.InputLegacyModule | ~9 KB | Input, KeyCode, Touch, etc. | | UnityEngine.UnityWebRequestModule | ~14 KB | UnityWebRequest, DownloadHandler, etc. | | Unity.InputSystem | ~342 KB | InputAction, InputDevice, Keyboard, Mouse, etc. |

Helper Types

The package includes helper types for C# interop:

// Reference parameters (ref keyword in C#)
declare interface $Ref<T> { __doNotAccess: T }

// Output parameters (out keyword in C#)
declare interface $Out<T> { __doNotAccess: T }

// Task/async return types
declare interface $Task<T> { __doNotAccess: T }

Versioning

Package versions match Unity versions:

| Package Version | Unity Version | |-----------------|---------------| | 6000.5.x | Unity 6000.5.x | | 6000.3.x | Unity 6000.3.x |

Use semver ranges to get compatible updates:

# Exact version
npm install -D [email protected]

# Compatible updates within Unity 6000.5
npm install -D unity-types@~6000.5.0

Generating Custom Types

If you need types for additional Unity assemblies or your own C# code, use the TypeGenerator in Unity:

// Via menu: OneJS > Type Generator

// Or programmatically:
TypeGenerator.GenerateFromAssembly("output.d.ts", "MyGame.Core");

// Or use the fluent API:
TypeGenerator.Create()
    .AddType<MyCustomClass>()
    .AddNamespace("MyGame.Systems")
    .Build()
    .WriteTo("my-types.d.ts");

Regenerating this package

Against the editor whose Unity version the package will claim, with the project open and the OneJS MCP bridge up:

  1. For each assembly below, run the generator and write it over the file of the same name:

    OneJS.Editor.TypeGenerator.TypeGenerator.Create()
        .AddAssemblyByName("UnityEngine.CoreModule").Build()
        .WriteTo("<repo>/JSModules/unity-types/UnityEngine.CoreModule.d.ts", false);

    The nine: UnityEngine.CoreModule, UnityEngine.UIElementsModule, UnityEngine.InputLegacyModule, Unity.InputSystem, UnityEngine.PhysicsModule, UnityEngine.Physics2DModule, UnityEngine.AudioModule, UnityEngine.UnityWebRequestModule, OneJS.

  2. node tools/strip-preamble.mjs

  3. Bump version and description in package.json, and the table above.

index.d.ts and _system.d.ts are hand written and are not regenerated. They hold the triple-slash references, the ES6 module declarations, and the $Ref, $Out and $Task helpers the generated files use.

Nothing else is hand edited. Earlier releases were: roughly 1300 array types and 118 System.TypeLike parameters were written in by hand over the generator's output, because the generator emitted any for every array and System.Type for every Type parameter. Both are fixed in the generator as of OneJS 3.4.3, so a regeneration now reproduces them. If you find yourself editing a generated file, fix the generator instead: the hand written layer is also how System.TypeLikeCode, a type that exists nowhere, reached two published signatures.

License

MIT