Create a GPT driven NPC using Inworld AI - Part 2: Import Character into Unity

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign to the second part in a short series on in World AI inworld is a developer platform that simplifies the creation of virtual characters that can converse in real time via AI generated dialogue these characters can be given 3D avatars and imported into game engines such as Unity or unreal in the previous video we explored the platform's features we looked at there in World Origins demo a short Prototype game which showcased the capabilities of the in-world platform we then went through the process of creating our very own AI character using in world's online character creation tool if you have not watched the first part of this series then I recommend that you do so before continuing with this tutorial Link in the description okay you should have a character ready which you have created via in-world's web-based character Studio I'm now going to show you how to import this character into a Unity project let's open Unity Hub and create a fresh project click the new project button make sure that the latest LTS version of unity 2022 is selected select the 3D urp template if need be click the download template button give your project a name and click the create project button our new project is now loaded and opened in the unity editor at this point switch to a web browser and navigate to the unity asset store the asset store can be found at assetstore.unity.com on the asset store select the AI category this will take you to the store's new AI Hub page scroll down and you should find inworld's Unity package it's called ainpc engine click on it now click on the large blue button that says add to my assets you will notice that since I've already got this asset my button reads open in unity instead once you have clicked the add to my assets button you should also be given the option to open the package in unity I would encourage you to do this in any case let's go ahead and click the blue button the unity editor with your open project should now come to the fore notice that the package manager has been automatically opened with the in-world unity package pre-selected incidentally if you need to open the package manager manually go to the top menu bar and select window and then package manager to find the in-world package in the package manager select my assets from the packages filter menu [Music] with the AI NPC engine package selected click the download button once the package has finished downloading click the import button the import Unity package panel will appear once again click the import button at the bottom [Music] once the package has finished importing you will notice a new folder in your Project's assets the inworld.ai folder okay you can close the package manager now let us begin setting up the in-world engine within Unity go to the project panel and under assets expand the inworld.ai folder inside this expand the resources folder and then select the API Keys folder in the folder contents panel you should see a file called default workspace key select this in the inspector panel you will notice that the default workspace key requires two pieces of information your in World workspace API key and secret let's find those API Keys now go to your web browser and navigate to your in-world studio page make sure that the workspace containing your custom character is currently selected in the left sidebar click on Integrations on the Integrations page scroll down to the API Keys section notice that there is both a key and secret string here ready for you to copy over to Unity copy each of the keys separately using the copy buttons provided in unity paste them into the relevant text fields on the default workspace key component let us now open the in-world studio panel in the unity editor go to the main menu bar you will notice that a new in-world menu has appeared on the menu bar click on this from this menu select Studio panel in world's UI requires some text mesh Pro Resources so you may be prompted to import these at this point if so go ahead and import them you will now be presented with the in-world studio panel before you can import your custom character however you will need to log in Via this panel click the login button in order to complete the login you will need to supply a studio access token for your in-world workspace go back to the Integrations page in your web browser go to the studio access token section and click on generate Studio access token a large text string will be generated use the button provided to copy it now switch back to the unity editor and on the in-world studio panel paste the token into the auth token text box and finally click the login button beneath this once logged in you will be prompted to select a workspace from the workspace drop down menu select the workspace in which your custom character resides in my case this is the interesting people workspace notice the key drop down menu select your workspace key from this finally there is also an in-world scene drop down menu select the in-world scene which your character occupies in my case this is Tesla's Laboratory a quick point do not confuse the in-world scene with a Unity scene the in-world scene is simply a text description of the surroundings that a character finds themselves in we created an in-world scene for our Nikola Tesla character in the previous video namely his New York laboratory it would make sense for an in-world scene to closely describe its corresponding 3D Unity scene however in fact let us start working with our Unity scene we currently have the default sample scene open this is a fairly empty scene bar a few standard game objects such as a camera and a light so let's just continue working with the sample scene notice inworld has already automatically added an in-world controller to our scene hierarchy this is the main game object that manages the in-world system in the scene we also need an in-world player controller so let's add one now by clicking add player controller to Unity scene Unity will warn you that adding a player controller will delete the current camera click the OK button we are now ready to add our character Avatar to the scene at the bottom of the studio panel you will see thumbnails of avatars that are in your current in-world scene in my case I have a thumbnail of my Nikola Tesla Avatar select an avatar and then close the studio panel clicking on your Avatar's thumbnail has selected the Avatar's model in your project assets drag the Avatar model into the scene View take a quick look at the hierarchy View notice that the Nikola Tesla Avatar has automatically added itself as a child object of the in-world controller with Nikola Tesla selected in the scene hierarchy I'm going to reposition him so that he is directly in front of the player controller I'm also going to turn Tesla around so that he is facing the camera that is attached to the player controller okay we are ready to test this out make sure you have an active microphone and hit the play button in the unity editor hello sir [Music] ah greetings my friend how may I assist you today tell me about your induction motor ah my induction motor a true Marvel of engineering you see my friend the induction motor is a masterpiece of Simplicity and efficiency it operates on the principles of electromagnetic induction utilizing rotating magnetic fields to generate motion it was a breakthrough invention that revolutionized the world of electrical power you see with my induction motor I eliminated the need for brushes and commutators making it far more reliable and maintenance free than its predecessors it was a true Game Changer in the field of electrical engineering at this point I should make you aware that when interacting with your character via the in-world API you will incur a cost in in-world credits this means that when you're talking to your character while in unity's play mode you will be using up credits this also applies to builds of your project credits are not deducted however while you are talking to characters through in-world's browser-based character Studio when you first sign up for an in-world account you are given a free plan which comes with some free credits which are known as in World minutes although the free plan is fine for initial testing you may want to consider the paid plans if you wish to do anything serious within world okay before we wrap up I would like to highlight an error that I have encountered when creating an executable build of the project I will then show you how to fix this problem let me kick off a Windows build and show you what I've encountered as you can see the build has failed I'm not sure which versions of unity that this affects although I am using unity2022.3.5 here in any case I have discovered what is causing the problem there is a conflict occurring with a third-party Library called json.net by newtonsoft a copy of which is bundled in with the in-world unity package I will now show you how to rectify the problem select the project panel go to the project assets and in the inworld.ai folder select the plugin subfolder now go into the third party folder within this you will find a folder called newtonsoft.json delete this entire folder next we want to install the latest version of json.net as a separate Unity package open the package manager click on the plus icon in the top left corner and from the drop down menu select add package by name in the name text field type the following string com.unity.nugget dot newtonsoft hyphen Json click the add button the json.net package will be immediately downloaded and imported once json.net has finished importing close the package manager and kick off another build [Music] this time the build should complete successfully okay we have reached the end of this tutorial in the next part we will get our in-world character working in VR by using unity's XR interaction toolkit if you found this video useful please like And subscribe goodbye and see you in the next video [Music]
Info
Channel: Ludic Worlds
Views: 2,743
Rating: undefined out of 5
Keywords:
Id: BI4CYExdptA
Channel Id: undefined
Length: 11min 3sec (663 seconds)
Published: Wed Jul 26 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.