This tutorial will provide the setup instructions for a trigger area.
An empty example scene is prepared with a player controller, you can find this scene in the following location:
|Assets\TurnTheGameOn\NPC Chat\Example Scenes\NPCChat_ExampleScene|
- Add the NPC Chat prefab object to the scene (you can disable the object named NPC in the scene and place it where he was).
- Assign the following preset NPC Chat Options in the NPC Chat inspector:
This preset profile is configured with the default settings required for a colliding object with the tag ‘Player’ to trigger NPC Chat.
- Next we need to setup the collider, first remove the capsule collider and add a box collider to better control the bounds of our area. Then set the collider Is Trigger value to true, and adjust the collider’s center and size values to set its bounds.
If you brought the NPC Chat object into the scene as a prefab, you’ll need to unpack it to customize it. Right click the object and select Unpack Prefab Completely to create a unique object that you can customize and save as your own prefab.
- Assign the “Player ThirdPersonController” object from the scene as the Player (Transform) reference in the NPC Chat inspector.
- You can customize this chat boxes UI components however you like with new sprites, dimensions or other components. In this tutorial I will disable everything but the Background Image and Dialogue Text since all we want is a simple notification area. I will also disable Use Render Texture from the Chat Box script inspector.