Dialogue For Split Screen Using a Gamepad

Announcements, support questions, and discussion for the Dialogue System.
Lockes_TheThief
Posts: 41
Joined: Tue Apr 13, 2021 11:46 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Lockes_TheThief »

I'm using the TPC: https://assetstore.unity.com/packages/t ... ler-126347

And I'm using the New Unity Input System.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Tony Li »

Thanks! I might not get the example scene posted here until tomorrow, but I'll post it as soon as I can.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Tony Li »

Sorry again, I'm running really behind this weekend. I got the Opsive split screen and new Input System stuff set up in an example scene. I just need to set up the Dialogue System stuff, which should be relatively quick. I'll try to get it posted here early tomorrow.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Tony Li »

Thanks for your patience. It's been a busy weekend! Here's an example scene:

TPC_DS_Test_Scene_2021-04-18.unitypackage

It demonstrates these things:
  • TPC split screen.
  • When targeting an NPC, the "TALK" message should only appear on one player's side.
  • When conversing, the NPC's bubble subtitle panel faces the player that's talking with it.
  • Each player has its own menu using A/B/X buttons.
Let's first make sure that works the way you're looking for. Then we can add in quests or whatever else you need.

Some notes on how it's set up:
  • General:
    - I set it up according to Opsive's Split Screen and Input System integration instructions. The players just use Opsive's default Input System CharacterInput asset.
    - Then I imported the Dialogue System & integration, and set it up according to the instructions.
  • Dialogue Manager:
    - Deactivated Instantiate Prefabs - don't need any of them.
    - Input Device Manager: Set Input Device to Mouse so it doesn't auto-focus button; unassigned the * To Check lists.
  • NPC:
    - Added Bubble Template Standard UI Subtitle Panel
    - Replaced AlwaysFaceCamera with custom script on NPC.
    - Set up DialogueActor (Subtitle Panel Number set to Custom).
  • Players:
    - Added menu prefab
    - Set up DialogueActor. (Menu Panel Number set to Custom, Use For: Me And Responses To Me).

If the example scene doesn't work after importing it into a TPC/DS project, let me know and I'll send you the entire example project.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Tony Li »

I forgot to mention that, since I used the default input actions without modifying anything, one player may end up using KBM controls and the other using a gamepad. It's not particularly relevant. As long as they use different controls and each player can interact separately with the NPC, it should serve the purpose of the test scene. I don't remember if I ticked the Dialogue Manager's 'Allow Simultaneous Conversations' checkbox. You'll want to tick this in case both players want to talk to the NPC at the same time.
Lockes_TheThief
Posts: 41
Joined: Tue Apr 13, 2021 11:46 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Lockes_TheThief »

Oh cool. I'll check all this out. I've been busy too, so no worries. I'll let you know if I have any issues
Lockes_TheThief
Posts: 41
Joined: Tue Apr 13, 2021 11:46 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Lockes_TheThief »

Okay, here's what is going on. First and most importantly, when I add the FacePlayerOnConversationStart to my NPC, it usually crashes Unity when I play. Not sure why. On your test scene it works, but on mine it doesn't. Also, it looks like (and I'm not sure, but) when making a conversation, the NPC only talks to Player 1? Like, on yours, it does show the message bubble in the right place, but the Goodbye and Later Dude options are only on Player 1's screen. Other than that, the talk indicator is on the right screen when a player walks up to it.
User avatar
Tony Li
Posts: 22102
Joined: Thu Jul 18, 2013 1:27 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Tony Li »

Hi,

Did you assign the Bubble Template Standard UI Subtitle Panel to FacePlayerOnConversationStart's Transform To Rotate field?

facePlayerOnConversationStart.png
facePlayerOnConversationStart.png (65.82 KiB) Viewed 1091 times

I'm not quite sure how FacePlayerOnConversationStart could crash Unity. This is the entirety of the script:

Code: Select all

public class FacePlayerOnConversationStart : MonoBehaviour
{
    public Transform transformToRotate;

    void OnConversationStart(Transform playerTransform)
    {
        var targetRotation = Quaternion.LookRotation(playerTransform.position - transformToRotate.position);
        transformToRotate.rotation = Quaternion.Euler(
            transformToRotate.rotation.eulerAngles.x, 
            targetRotation.eulerAngles.y + 180,
            transformToRotate.rotation.eulerAngles.z);
    }
}
(Edit: Updated to handle TAM scene.)

It just sets the rotation of transformToRotate.


When each player talks to the NPC, that player's menu panel should be used. For example, when the left player interacts:

player1Talks.png
player1Talks.png (529.12 KiB) Viewed 1091 times

And when the right player interacts:

player2Talks.png
player2Talks.png (520.71 KiB) Viewed 1091 times

I just PM'd you a download link for the project. Maybe there's a different in project settings. If you can confirm that the project I sent you works, we can identify what setting is different in your project.
Lockes_TheThief
Posts: 41
Joined: Tue Apr 13, 2021 11:46 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Lockes_TheThief »

I did put the bubble in the script. I was confused myself. Maybe there are some internal errors going on in my game because like you showed, this script isn't complex enough to break the game. However, when I add it the game does crash. Without it, there are errors, I might have to post them, but they aren't based on anything you've given me.

Ask for the split screen menu only showed up on player1's side, even on the project I downloaded, but I will check the thing you sent to see if there's any difference. It is probably something I'm missing in relating the canvas monitors to the right cameras. But I'll update you once I get to it.

Thanks!
Lockes_TheThief
Posts: 41
Joined: Tue Apr 13, 2021 11:46 pm

Re: Dialogue For Split Screen Using a Gamepad

Post by Lockes_TheThief »

Yup, looks like the project you sent shows the right format. The menus are appearing normally in the right screens. So that means it has something to do with my settings...
Post Reply