UniGPT Project Overview
UniGPT is an innovative tool designed to seamlessly integrate advanced AI models into the Unity Editor, enhancing the code generation and execution processes. This application harnesses the power of popular AI tools like ChatGPT, New Bing, and Google Bard, enabling developers to input commands directly within Unity and receive executable code immediately.
Key Features
-
AI Integration: UniGPT allows users to utilize AI services such as ChatGPT, New Bing, and Google Bard while working in the Unity environment. This feature is designed to generate and execute code efficiently based on user instructions.
-
Streaming Output: The tool supports text output through a streaming process, making interactions smooth and continuous.
Installation Requirements
To use UniGPT, ensure that your Unity version is 2019.3 or later. This requirement ensures compatibility with the integrated Python environment necessary for running UniGPT.
Initial Environment Setup
-
Environment Initialization: Once inside a Unity project, allow the Python environment to initialize. Navigate to
Edit -> Project Settings -> Python Scripting
and launch the Terminal. -
Install Necessary Packages: Execute the following commands in the terminal to install requisite Python packages:
python -m pip install --upgrade pip python -m pip install revChatGPT python -m pip install EdgeGPT python -m pip install GoogleBard
-
AI Configuration: Follow subsequent tutorials to correctly configure each AI service.
User Guide
Setting Up ChatGPT
- Obtain your ChatGPT API key by visiting the OpenAI platform.
- Edit the JSON configuration file located at
Assets/IntegrationGPT/Config~/chat_gpt_config.json
to include your API key. - If located within China, you can deploy a Tencent Cloud function as an API proxy and update the
api_url
accordingly.
{
"api_key": "sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"model": "gpt-3.5-turbo",
"proxy": "http://127.0.0.1:1080",
"api_url": "",
"prompt": {
"聊天": "",
"生成并执行代码": "我想让你在Unity里面实现一个需求, 然后你给我回复代码, 你需要将实现逻辑写在TemplateClass中的Test静态方法里面, ..."
}
}
Setting Up New Bing
- Ensure access to New Bing and retrieve necessary cookies.
- Transfer these cookies to
Assets/IntegrationGPT/Config~/new_bing_cookies.json
. - Edit the configuration file
Assets/IntegrationGPT/Config~/new_bing_config.json
for settings such as conversation style and API URL.
{
"style": "precise",
"proxy": "http://127.0.0.1:1080",
"api_url": "",
"prompts": {
"聊天": "",
"生成并执行代码": "我想让你在Unity里面实现一个需求, ..."
}
}
Setting Up Google Bard
- Confirm your participation in Google Bard and secure a session token.
- Edit the configuration file
Assets/IntegrationGPT/Config~/google_bard_config.json
with your session token and proxy settings if necessary.
{
"session": "",
"proxy": "",
"prompts":{
"Chat": ""
}
}
References
UniGPT offers developers a cutting-edge solution to integrate AI-driven code generation within Unity, enhancing productivity and fostering innovative development workflows.