ChatGPT in the Unity Game Engine

ChatGPT from OpenAI is an amazing artificial intelligence chat bot from AI that has proven to be remarkably capable of coding. In fact, we did a video back in December about using ChatGPT as a Godot tutor and it does a shockingly good job… until it doesn’t. Today we are looking at a proof of concept of using ChatGPT in the Unity game engine, created by Unity engineer Keijiro Takahashi. Using simple text commands you can create and modify objects in the Unity game engine. Just like the Godot tutor scenario, it does a shockingly good job… until it doesn’t.

Frequently asked questions from the GitHub repository:

Is it practical?

Definitely no! I created this proof-of-concept and proved that it doesn’t work yet. It works nicely in some cases and fails very poorly in others. I got several ideas from those successes and failures, which is this project’s main aim.

Can I install this to my project?

This is just a proof-of-concept project, so there is no standard way to install it in other projects. If you want to try it with your project anyway, you can simply copy the Assets/Editor directory to your project.

AICommandWindow throws NullReferenceException

Probably your OpenAI trial period has expired. Please check your billing status. See AIShader issue #1 for details.

I pressed the “Run” button, resulting in compilation errors.

In many cases, ChatGPT fails to implement your command correctly. You might get the correct one by repeatedly pressing the “Run” button.

(That’s why I think this PoC is impractical…)

You can easily check it out yourself, simply clone the repository and open it in Unity 2022.2 or later. You will need an OpenAI ChatGPT API key that you need to enter in Project Settings -> Ai Commands inside Unity. This is only a proof of concept, but as you can see from the video, it works shockingly well… when it works.

You can learn more about using ChatGPT in the Unity game engine in the video below.

Scroll to Top