Hello!
Dialogue System is an amazing asset, with tons of features. Keeping in mind that I am a beginning developer, it might be highly possible that I might come across silly doubts!
Apologies in advance and Noob-Alert ahead!
I have a situation where after completing a conversation with NPC, I require a set of questions to be asked to player, and I have a computer screen asset in my scene. I am looking forward to use that, to provide a feeling of interacting with in-game computer!
I referred the interaction with Terminal in Demo Scene 1, provided as sample with Dialogue System. It is almost similar to what I am looking forward to implement, except for the fact that I require the NPC Subtitles and Response Buttons, to appear on the computer screen asset, in order to exactly match the UI experience.
I set up a scene, where I created a new camera, as a child of the computer asset, and set it accordingly, to show the desired view. After setting up the new camera, I disabled it. Then, I provided an extra collider to the object, so that player's proximity selector component can detect the computer object to interact with, "OnUse".
Then, I added "Usable", "Dialogue System Trigger" and "Override UI" components to the computer asset.
In the Dialogue Manager > Camera & Cutscene Settings > Sequencer Camera, I passed the newly created camera object.
Player's proximity selector does show the computer asset name, when it is in radius of the computer screen asset.
Now, when player interacts with computer screen asset, I want my game view, to transition to computer screen asset.
As I have not specified any actions in Dialogue System Trigger so far, the sequencer camera does change the angle to desired view, but only momentarily. As soon as my desired view is reached, the game view is reverted back to it's original position. What I mean to say is, the view which the sequencer camera represents, is quickly reset to game view which the main camera represents!
Note that I have a camera follow script attached to player, which would put the main camera, as a child of Player, at runtime, and a camera collision script attached to main camera!
So, initially when player's proximity selector show's computer screen asset, and when player interacts with it, the game view needs to transition to a different view, that which shows only computer screen.
Next, I require a button, which would be present in the centre of the computer screen asset. In order to do that, I created a new button, as a child object of computer asset. Note that a new Canvas object gets created first, which acts as immediate child of computer asset. The button is then created as child of the canvas object.
Then, I set the Renderer of newly created Canvas to Screen Space Overlay.
What I want is, the button to be activated, when player interacts with computer screen asset. So, I disabled the newly created button object, and then added an action of activating that button, using computer screen asset's > Dialogue System Trigger > Actions > Set Game Object Active/Inactive component.
Now, I want the conversation to be started, when the button I created earlier is clicked. So, I passed the object "Dialogue Manager" to "OnClick()" property of previously created button and set the function "StartConversation()".
So far when I test this, when player interacts with computer asset, sequencer camera does momentarily change the angle, but it gets reset to main camera's view, as soon as it reaches the desired view. Then, the button which I created earlier, does show up, and when I click it, the conversation gets started.
But, the conversation show's the name of previous NPC character, and sometimes the Dialogue UI does not get overridden. Also, when response menu is triggered after NPC dialogue, response button is non-functional and I'm not able to click it. Therefore, I'm not able to proceed ahead in the conversation.
Talking about the conversation, I have questions which would be a part of NPC subtitles. But I require at least 4 Radio Buttons or 4 regular buttons, in the response menu. But those buttons should be represented separately and independently, and not in scrollable view. I tried, but was not able to get it appropriately. So, if there's any way by which I could do that, your help would be much appreciated!
And, As an alternative to creating a new camera and passing it to Dialogue Manager's Sequencer Camera slot, I created an empty game object, to represent the position, which would provide the desired view. I named that object "CameraAngle". Then, I set the sequence manually, using Camera(CameraAngle,,1) command, in the first dialogue.
But even that didn't work. Like, the same issue would persist where the desired view would be changed momentarily and then get reset back to main camera's view.
To sum up, this is what I'm trying to accomplish:
1) Transition to computer screen view, when player interacts with computer screen asset.
2) A button in the centre of screen, which would be activated once the player interacts with computer screen asset, and which when clicked, would start the conversation. And then get deactivated when conversation ends.
3) Multiple response buttons, at least 4 and first preference radio buttons or any other form of buttons, not in scrollable view.
4) Transition back to original view, when conversation is ended or cancelled.
Any help would be much appreciated!
And Dialogue System is truly an amazing asset!
Kind Regards,
Bhavin.
Interaction with in-game computer
Re: Interaction with in-game computer
Hi Bhavin,
I recommend creating a custom dialogue UI for your computer. As a child of the computer screen, make a world space canvas that exactly fits the computer screen. Build your dialogue UI inside this canvas.
Add an Override Dialogue UI component to the computer and assign the custom dialogue UI to it.
As another child of the computer screen, create an empty GameObject at the position where you want the camera to be. For example, let's say you name it "Computer Camera Position".
Add a Dialogue System Trigger to the computer. Configure it to play the computer conversation.
Use a Dialogue System Events component on your player to disable any gameplay camera scripts. This will allow the conversation to take control of the camera.
In the first node of the conversation, use the Camera() sequencer command to move the camera into position. For example:
In the last node of the conversation, use the Camera() sequencer command to move the camera back to its original, pre-conversation position:
I recommend creating a custom dialogue UI for your computer. As a child of the computer screen, make a world space canvas that exactly fits the computer screen. Build your dialogue UI inside this canvas.
Add an Override Dialogue UI component to the computer and assign the custom dialogue UI to it.
As another child of the computer screen, create an empty GameObject at the position where you want the camera to be. For example, let's say you name it "Computer Camera Position".
Add a Dialogue System Trigger to the computer. Configure it to play the computer conversation.
Use a Dialogue System Events component on your player to disable any gameplay camera scripts. This will allow the conversation to take control of the camera.
In the first node of the conversation, use the Camera() sequencer command to move the camera into position. For example:
Code: Select all
Camera(Computer Camera Position, , 2)
Code: Select all
Camera(original, , 2)
-
- Posts: 42
- Joined: Sun Jul 26, 2020 3:51 pm
Re: Interaction with in-game computer
Thank You very much, for the help!
I would be working upon it, as per the instructions you provided.
Apart from that, how do I set up multiple response buttons?
For instance, if I require 4 response buttons, should I create 4 buttons and place them in my newly created world space canvas, under the response menu panel?
How to map those buttons to each response, in the conversation?
Your help is much appreciated!
I would be working upon it, as per the instructions you provided.
Apart from that, how do I set up multiple response buttons?
For instance, if I require 4 response buttons, should I create 4 buttons and place them in my newly created world space canvas, under the response menu panel?
How to map those buttons to each response, in the conversation?
Your help is much appreciated!
Re: Interaction with in-game computer
Hi,
There are two ways to create response buttons:
1. Create 4 buttons, and assign them to your StandardUIMenuPanel component's Buttons list. For each response menu, the conversation will use as many buttons as it needs (up to 4) and hide the rest.
2. Or create a single button that will be used as a template, and assign it to the StandardUIMenuPanel's Button Template. For each response menu, the conversation will instantiate as many copies of this button template as it needs. (It pools them, so it doesn't have to keep instantiating new buttons with every menu.)
There are two ways to create response buttons:
1. Create 4 buttons, and assign them to your StandardUIMenuPanel component's Buttons list. For each response menu, the conversation will use as many buttons as it needs (up to 4) and hide the rest.
2. Or create a single button that will be used as a template, and assign it to the StandardUIMenuPanel's Button Template. For each response menu, the conversation will instantiate as many copies of this button template as it needs. (It pools them, so it doesn't have to keep instantiating new buttons with every menu.)
-
- Posts: 42
- Joined: Sun Jul 26, 2020 3:51 pm
Re: Interaction with in-game computer
Hello,
As per the instructions you gave in the thread above, I was creating a custom Dialogue UI, for the newly created World-Space Canvas, which is of the size of computer screen asset.
Now, I came across a situation, based upon the above discussion, about implementing multiple response buttons, 4 buttons in this case.
I'm using Unity Game Engine for this project.
I require radio buttons as response buttons.
In short, I need 4 options as responses, and the player should be able to select only one option out of 4, and only after selecting one option, the player should be able to proceed ahead in the conversation!
As a child object of World Space Canvas, I created a Response Menu Panel, which has "Standard UI Menu Panel" component attached to it.
Then, as children of Response Menu Panel, I created 4 Toggle objects.
Though, I don't know if there's any other, direct way of implementing radio buttons in Unity, but there's one option which I came across, to create radio buttons, by using Unity UI's Toggle object.
But the thing with toggle is, it does NOT have any Button component on it.
It rather has a Toggle component on it, in place of Button!
The scripts - "Standard UI Menu Panel", "Standard UI Response Button", and "Unity UI Response Button" won't be accepting toggle object, as it does not have any button component on it!
Is there any way by which I could make that work?
As per the instructions you gave in the thread above, I was creating a custom Dialogue UI, for the newly created World-Space Canvas, which is of the size of computer screen asset.
Now, I came across a situation, based upon the above discussion, about implementing multiple response buttons, 4 buttons in this case.
I'm using Unity Game Engine for this project.
I require radio buttons as response buttons.
In short, I need 4 options as responses, and the player should be able to select only one option out of 4, and only after selecting one option, the player should be able to proceed ahead in the conversation!
As a child object of World Space Canvas, I created a Response Menu Panel, which has "Standard UI Menu Panel" component attached to it.
Then, as children of Response Menu Panel, I created 4 Toggle objects.
Though, I don't know if there's any other, direct way of implementing radio buttons in Unity, but there's one option which I came across, to create radio buttons, by using Unity UI's Toggle object.
But the thing with toggle is, it does NOT have any Button component on it.
It rather has a Toggle component on it, in place of Button!
The scripts - "Standard UI Menu Panel", "Standard UI Response Button", and "Unity UI Response Button" won't be accepting toggle object, as it does not have any button component on it!
Is there any way by which I could make that work?
Re: Interaction with in-game computer
Hi,
Yes. Don't use StandardDialogueUI for that UI. Instead, set up your UI elements, and write a script that implements the C# IDialogueUI interface. (You can start with the template script in Plugins / Pixel Crushers / Dialogue System / Templates / Scripts for a head start.)
Yes. Don't use StandardDialogueUI for that UI. Instead, set up your UI elements, and write a script that implements the C# IDialogueUI interface. (You can start with the template script in Plugins / Pixel Crushers / Dialogue System / Templates / Scripts for a head start.)
-
- Posts: 42
- Joined: Sun Jul 26, 2020 3:51 pm
Re: Interaction with in-game computer
Thank you very much for your help!
I would be working upon that, as you suggested!
I would be working upon that, as you suggested!