Spaces:
Build error
Build error
Commit Β·
050de2f
1
Parent(s): d00747b
final UI polish
Browse files
README.md
CHANGED
|
@@ -10,5 +10,47 @@ pinned: false
|
|
| 10 |
---
|
| 11 |
# Unity β Unreal Code Translator
|
| 12 |
|
| 13 |
-
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
# Unity β Unreal Code Translator
|
| 12 |
|
| 13 |
+
# Overview
|
| 14 |
|
| 15 |
+
**Unity β Unreal Code Translator** is an AI-assisted developer tool that automatically converts Unity C# scripts into Unreal Engine-ready C++ and Blueprint Python scripts.
|
| 16 |
+
It's designed to help developers migrate gameplay logic, components, and class structures from Unity to Unreal with minimal manual rewriting.
|
| 17 |
+
|
| 18 |
+
Powered by large language models (Hugging Face or OpenAI), it understands Unity's MonoBehaviour patterns and maps them to equivalent Unreal constructs such as AActor, UCLASS, UPROPERTY, and UFUNCTION.
|
| 19 |
+
|
| 20 |
+
# Key Features
|
| 21 |
+
|
| 22 |
+
**Automatic Code Translation** β Converts Unity C# code to Unreal C++ header/source files and Blueprint Python scripts.
|
| 23 |
+
|
| 24 |
+
**Smart Mapping Rules** β Uses a customizable mapping_table.json to define how Unity APIs map to Unreal equivalents.
|
| 25 |
+
|
| 26 |
+
**Header & Source Separation** β Outputs clean, compile-ready .h and .cpp files using Unreal coding conventions.
|
| 27 |
+
|
| 28 |
+
**Blueprint Generation** β Creates Unreal Python scripts that can build Blueprint actors directly in Unreal Editor.
|
| 29 |
+
|
| 30 |
+
**Downloadable Files** β Exports .h and .cpp files automatically named after your Unity class (e.g., PlayerController.h).
|
| 31 |
+
|
| 32 |
+
**Backend Flexibility** β Choose between Hugging Face (Mistral) or OpenAI (GPT-4o-mini) model backends.
|
| 33 |
+
|
| 34 |
+
**Interactive UI** β Simple, responsive Gradio interface with separate tabs for C++ and Blueprint outputs.
|
| 35 |
+
|
| 36 |
+
# Tech Stack
|
| 37 |
+
|
| 38 |
+
**Frontend**: Gradio (for interactive UI)
|
| 39 |
+
|
| 40 |
+
**Backend**: Python (Fast LLM inference + file generation)
|
| 41 |
+
|
| 42 |
+
**LLM Models**: Hugging Face Mistral-7B-Instruct-v0.3 / OpenAI gpt-4o-mini
|
| 43 |
+
|
| 44 |
+
**Mapping Logic**: JSON-based Unity to Unreal API mapping
|
| 45 |
+
|
| 46 |
+
**File Outputs**: Unreal-style .h, .cpp, and Python script files
|
| 47 |
+
|
| 48 |
+
# How It Works
|
| 49 |
+
|
| 50 |
+
**Parse**: The Unity C# code is analyzed to extract class names, variables, and functions.
|
| 51 |
+
|
| 52 |
+
**Map**: Each Unity API call or type is matched with Unreal equivalents using mapping_table.json.
|
| 53 |
+
|
| 54 |
+
**Synthesize**: A large language model generates the Unreal C++ and Blueprint Python versions.
|
| 55 |
+
|
| 56 |
+
**Split & Save**: The generated output is divided into .h and .cpp sections and made downloadable.
|
app.py
CHANGED
|
@@ -6,7 +6,7 @@ import re
|
|
| 6 |
agent = TranslationAgent()
|
| 7 |
|
| 8 |
title = "Unity β Unreal Code Translator"
|
| 9 |
-
description = "
|
| 10 |
|
| 11 |
|
| 12 |
def extract_class_name(csharp_code: str) -> str:
|
|
@@ -67,7 +67,7 @@ def do_translate(csharp_code, target_format, model_choice):
|
|
| 67 |
|
| 68 |
# Gradio UI
|
| 69 |
with gr.Blocks(title=title) as demo:
|
| 70 |
-
gr.Markdown(f"###
|
| 71 |
gr.Markdown(description)
|
| 72 |
|
| 73 |
with gr.Row():
|
|
|
|
| 6 |
agent = TranslationAgent()
|
| 7 |
|
| 8 |
title = "Unity β Unreal Code Translator"
|
| 9 |
+
description = "AI-assisted developer tool that automatically converts Unity C# scripts into Unreal Engine-ready C++ and Blueprint Python scripts. It's designed to help developers migrate gameplay logic, components, and class structures from Unity to Unreal with minimal manual rewriting. Powered by large language models Hugging Face Mistral and OpenAI"
|
| 10 |
|
| 11 |
|
| 12 |
def extract_class_name(csharp_code: str) -> str:
|
|
|
|
| 67 |
|
| 68 |
# Gradio UI
|
| 69 |
with gr.Blocks(title=title) as demo:
|
| 70 |
+
gr.Markdown(f"### {title}")
|
| 71 |
gr.Markdown(description)
|
| 72 |
|
| 73 |
with gr.Row():
|