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

  1. 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).
  1. Assign the following preset NPC Chat Options in the NPC Chat inspector:
Assets\TurnTheGameOn\NPC Chat\Data\Presets\NPCChatOptions_NotificationArea

This preset profile is configured with the default settings required for a colliding object with the tag ‘Player’ to trigger NPC Chat.

  1. 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.

  1. Assign the “Player ThirdPersonController” object from the scene as the Player (Transform) reference in the NPC Chat inspector.
  1. Create a Canvas in the scene and add the “Default Chat Box” prefab to it.
  1. Assign the “Default Chat Box” object as the Chat Box reference in the NPC Chat inspector.
  1. Add some text in the Dialogue Text field in the NPC Chat inspector.
  1. 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.
  1. Disable the Chat Box object, and save the scene as a new scene for your future reference if needed. Press play and test the scene. Use the arrow keys to walk inside the collider trigger area to start chat and leave the trigger are to stop chat.

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Please do not use this for support questions.
For customer support, please contact us here.

Post Comment