This tutorial will provide the minimum setup instructions required settings to make an NPC intractable.

An empty example scene is prepared with a player controller and an non-player animated model for NPC Chat tutorials, 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 as a child of the NPC object.
  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 a name for the NPC to the Title Text field and some dialogue in the Dialogue Text field in the NPC Chat inspector. That’s it for configuring NPC Chat, next we’ll customize the chat box a little.
  1. If you brought the Chat Box 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. You can customize this chat boxes UI components however you like with new sprites, dimensions or other components. In this tutorial I will disable the buttons, player name input field, and enable the Portrait RawImage (to render the NPC’s animation).
  1. The last step would be to move and position the Render Texture Camera used for the Portrait RawImage to the NPC animated model in the scene. You may want to adjust this camera orientation through trial and error after testing play mode.
  1. Disable the Render Texture Camera and Chat Box objects, 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 to the npc and click on it to start 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