2D RPG setup with bone character

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
theglowingpond
Posts: 3
Joined: Fri Apr 29, 2022 10:06 am

2D RPG setup with bone character

Post by theglowingpond »

Hi everyone,
I am new to the dialogue system and to unity in general.
I was previously using another dialogue system from a YouTube tutorial which was working, but limited and a little wonky.

I have been working on a simple top down 2D RPG and I just purchased the dialogue system; I have tried setting up a simple NPC conversation by following the video tutorials multiple times, step by step, but the dialogue (or anything at all) just does not seem to show up in the game. The [press spacebar] text does not show up when I approach the NPC either. I am not sure how to proceed or why it is not working.

Here is some more general information about my game set-up;
My player character is a bone-animated 2D character. I have a simple animated movement system using PlayMaker which works well. I have a simple cinemachine camera with a smooth follow script following the player, this is working well too.
I am using the Universal Render Pipeline.
Should I be setting up the components on an empty child or parent game object? Or should I place them directly onto the player (with other scripts/components already attached)? Does this matter?

I would really appreciate anyone who can shed some light on why this isn't working. Please let me know if you need more details about my game!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: 2D RPG setup with bone character

Post by Tony Li »

Hi,

Welcome to Unity and the Dialogue System! It sounds like you already have a lot working (Cinemachine, player controller, etc.) so let's see if we can get conversations working quickly, too.

This tutorial video may be helpful: Interaction Tutorial

I recommend these steps to progressively get there:

1. In the Dialogue System's Welcome Window, tick the USE_PHYSICS2D checkbox. This enables the Dialogue System's 2D support.

2. Add a Dialogue System Trigger to your NPC if it doesn't already have one. Select Add Action > Start Conversation, and select the conversation. Set the Trigger dropdown to OnStart for now. Play the scene and make sure the conversation starts when the scene starts.

3. If that works, change the Dialogue System Trigger's Trigger dropdown to OnTriggerEnter.
  • Add a trigger collider to the NPC. This can be any type of 2D collider, such as a CircleCollider2D or BoxCollider2D. Tick its Is Trigger checkbox Your NPC can also have a regular, non-trigger collider on the same GameObject.
  • Click the Dialogue System Trigger's "Add 'Player' Tag" button.
  • On the player, make sure the main player GameObject's Tag is set to Player. Add a regular 2D collider if it doesn't already have one. You may also need to add a Rigidbody2D, which you can set to Kinematic (or not, if your player controller uses rigidbody physics).
  • Then play the scene. Walk into the NPC's trigger collider. Make sure it starts the conversation. If it doesn't, check the NPC's and player's layers. Make sure the layers are allowed to register collisions by checking the collision matrix with menu item Edit > Project Settings >> Physics2D.
4. If that works, change the Dialogue System Trigger's Trigger dropdown to OnUse.
  • Add a Proximity Selector component to the player GameObject. When asked if you want to add the Selector Use UI Elements component, click Yes.
  • Play the scene. Walk into the NPC's trigger collider. It should show a "use NPC" UI at the top of the screen. Press Space to start the conversation.
If you get to a point in the steps above where it doesn't work, let me know which step.

Once you get that working, you can make any of these tweaks if you want:
  • If you prefer, you can move the trigger collider to the player instead of the NPC.
  • You can also put the trigger collider and Proximity Selector on a child GameObject of the main player GameObject. If you do this, assign the main player GameObject to the Proximity Selector's Actor Transform field.
  • [As covered in the Interaction Tutorial, you can use a Dialogue System Events component to temporarily disable player movement during conversations.
theglowingpond
Posts: 3
Joined: Fri Apr 29, 2022 10:06 am

Re: 2D RPG setup with bone character

Post by theglowingpond »

I have tried these steps and tried making work the "bark" tutorial as well, without success.

I noticed that when was trying to work out step 3, in the project hierarchy the Dialogue Manager disappears as soon as I press play. Then, the NPC on the inspector has an error message in red stating "Last Check: False"
I am assuming this is a core part of the problem.
last check false.png
last check false.png (54.61 KiB) Viewed 632 times
Why is the Dialogue Manager disappearing when I Play?
Thank you for your help!
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: 2D RPG setup with bone character

Post by Tony Li »

Hi,

Is there a SaveSystem or InputDeviceManager component somewhere else in your scene other than on the Dialogue Manager GameObject?

It's okay for the SaveSystem component to be on a different GameObject, but in this case there must not be one on the Dialogue Manager, too.
theglowingpond
Posts: 3
Joined: Fri Apr 29, 2022 10:06 am

Re: 2D RPG setup with bone character

Post by theglowingpond »

Hi,
no I don't have a save system set up yet and I dont have an InputDeviceManager in the scene.
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: 2D RPG setup with bone character

Post by Tony Li »

Does your scene have a Dialogue Manager GameObject?

By default, the Dialogue Manager GameObject has an InputDeviceManager component. Did you remove this component?

Can you send a reproduction project to tony (at) pixelcrushers.com with reproduction steps?
User avatar
Tony Li
Posts: 21977
Joined: Thu Jul 18, 2013 1:27 pm

Re: 2D RPG setup with bone character

Post by Tony Li »

Hi,

Thanks for sending the reproduction project. I replied to your email.
Post Reply