@3dsource/types-unreal
Version:
A set of types for unreal module using in 3dsource projects
106 lines (71 loc) • 2.59 kB
Markdown
# @3dsource/types-unreal
A comprehensive collection of TypeScript type definitions for Unreal Engine integration. This library provides type
safety for communication between web applications and Unreal Engine.
## Overview
The types-unreal library offers:
- Type definitions for Unreal Engine commands and responses
- TypeScript interfaces for communication protocols
- Type-safe interaction with Unreal Engine from web applications
- Auto-generated types from Unreal Engine API specifications
## Installation
### Prerequisites
- TypeScript 5.8+
- Node.js 20+
### Peer Dependencies
This library requires the following peer dependencies:
```json
{
"@3dsource/unreal-commands-api-parser": "^1.0.27"
}
```
### Library Installation
```shell
npm i @3dsource/types-unreal
```
## Usage
### Basic Import
Import the types you need in your TypeScript files:
```typescript
import type { UnrealCommands } from '@3dsource/types-unreal';
import type { MetaBoxCommandPacket } from '@3dsource/types-unreal';
import type { MetaBoxCommandList } from '@3dsource/types-unreal';
import type { FLoopBackCommand } from '@3dsource/types-unreal';
```
### Available Types
The library provides the following key type categories:
- **Command Types** - Types for sending commands to Unreal Engine
- **Response Types** - Types for handling responses from Unreal Engine
- **Event Types** - Types for Unreal Engine events
- **Data Structure Types** - Types for complex data structures used in communication
### Example Usage
```typescript
import type { UnrealCommands, MetaBoxCommandPacket } from '@3dsource/types-unreal';
// Type-safe command creation
const command: MetaBoxCommandPacket = {
command: 'SetVisibility',
parameters: {
actorName: 'MyActor',
visible: true,
},
};
// Send command to Unreal Engine
function sendToUnreal(command: MetaBoxCommandPacket) {
// Implementation
}
sendToUnreal(command);
```
### Updating Types
To update the types from the latest Unreal Engine API specifications:
```shell
npm run generate:commands:prod
```
This command parses the Unreal Engine API and generates updated TypeScript definitions.
## Integration with Angular
This library works seamlessly with the `@3dsource/angular-unreal-module` for Angular applications:
```typescript
import { UnrealModule } from '@3dsource/angular-unreal-module';
import type { UnrealCommands } from '@3dsource/types-unreal';
// Your Angular module configuration
```
## Documentation
For detailed documentation of all available types, see the source code and comments in the type definition files.