This repository contains the code for the "Exploring Generative Agents in Unity" project. Since the project used several licensed assets, the full Unity project can't be uploaded. This README file explains how to set up the Unity project to replicate the project assuming that the same or similar assets are available.
The following assets were used in the project:
- Polygon - Town Pack: 3D models for the environment and agent.
- Odin Inspector and Serializer: Optional. Used for adding properties for better organization in the Unity Inspector window. It's not necessary for the project, if not available just remove any code that gives errors.
- LLM for Unity: LLM integration with Unity.
- Advanced Input Field 2: Emoji support in Unity.
- Serializable Dictionary: Having serialized dictionaries in Unity.
The project was made using Unity 6.
-
Import all the assets. If using the Synty Polygon Town pack, make a copy of the demo scene
-
Follow the instructions for creating an emoji font asset and make sure to add the corresponding scripting define symbols in the Player section of Project Settings.
-
Create an empty game object for the world representation and add the WorldTree script.
-
For each location of the world, create a game object with a box collider (set as trigger) that encompases the whole location and the AreaTrigger script
-
For each section within the location, create a game object with the box collider set as trigger and the AreaTrigger script set as section. Also add the ObjectState script to any object in the section.
-
Also create a game object that will represent the teleport location for the agent at each section.
Create a simulation settings game object, attach and configure the scripts as shown in the images.
For the memory configuration, the following settings were created:
The agent was configured using one of the Polygon Town pack characters. Attach the scripts as shown in the images.
The knowledge profile and agent templates that were used for the project were configured as shown here: