Adding Sensei AI to "uAI Assistant for Unity" (powered by ChatGPT)


Let the Sensei explain to you how to GameDev!

Game development can be hard - really hard. And there are a lot of things you have to know, and obviously you forget things through your journey of game development. This is normal and happens even to veterans.

So, how about a tool that can explain to you how to do things in Unity - Within Unity!

On the 6th of this month, I released "uAI Assistant for Unity" which is powered by the same AI model that powers ChatGPT. uAI can help you with many things, such as generating code that you describe with words, coming up with new names, quests, checking your spelling, etc.

Check it out here:

uAI

uA

New Tool: Sensei AI

Yesterday I got a question from a user who asked me if "uAI Assistant" could generate code, even if he doesn't know how to code. While my answer was obviously "yes, it can", I had to explain that it would still be better to know the basics of coding and how to use the code that uAI is generating.

While uAI can create code that you describe with words, you should know what the code does since humans can be very rough with descriptions and leave out information that would be very important for the AI to achieve exactly what you want. In the coming example, I will show you exactly what I mean by that.

The question from the user inspired me to add "Sensei AI", a tool that answers questions about game development. You can even ask it to explain a script or a code snippet to you. All that within Unity! 

Showcase ScriptCreator, SenseiAI and ScriptEditor

To showcase the possibilities of the uAI Assistant and the tools, I want to show you a step-by-step guide on how to create a code with the Code Creator, let the Sensei explain it to you, and even add functionality to that code postmortem!

Creating the script with ScriptCreator

1. Open the ScriptCreator window



2. Describe the script you want the AI to create for you. Here I choose "I need a script that can make a cube move around in a circle." By clicking on "Create script", the AI will generate a code based on your description.


3. Save the script: By clicking on the button "Create," you can create the script file. The name will be extracted from the code, and you can then choose the location where to save the file.

4. Open Sensei AI


5. Ask the Sensei what you want to know. In my case, I'd like it to explain to me how to use the code that uAI has previously generated. You could copy the code and paste it, or just select the script itself.


6.  Clicking on "Teach me!" will prompt the AI to explain how to use the code you have selected previously. Step by step!

Here is the code that uAI previously generated:


7. Now let's add new functionality to it! To do that, open the ScriptEditor window like in step 1. Click on the top right button "Edit existing code" and then the button "Use Script File". 

8. Choose the script you want to modify, and then describe the changes you want the AI to make for you. I choose "Add the functionality to stop and resume the movement at any time". Click on Edit the script.


9. The AI will make the modifications and tell you exactly what it has changed. Click on "Copy" to copy the code, and then open the code and paste it into the file.


10. The new code. 


11. I have hinted before that I will explain to you what I meant when I said, "Humans can be very rough with descriptions and letting out on information that would be very important for the AI to achieve exactly what you want."

When I told the AI that I wanted to be able to stop and resume the movement of the cube, I forgot to say that I wanted to be able to do so in the inspector and not through code calls! The AI assumed (correctly!) that I wanted two methods: "StopMovement" and "ResumeMovement". But what I wanted in this example was to be able to stop and resume the movement in the inspector. So what simple thing has to change for me to be able to do so?

12. public is the keyword! We have to make the variable "isMoving" public and not private. If I had written "Add the functionality to stop and resume the movement at any time IN THE INSPECTOR", uAI would have made the variable public, not private. My bad. 

Also, I have not specified the achsis at which the cube should circle around. The AI had to make the decision on its own.

Conlusion

So this was a little showcase of the capabilities of uAI and the new SenseiAI. I hope you like it, and I would appreciate it if you would give me feedback on that.

Demo Scene:

Get uAI - Unity3D AI Assistant powered by ChatGPT

Buy Now$15.99 USD or more

Leave a comment

Log in with itch.io to leave a comment.