Hi Pixel Crushers!
I'm having an issue locating an event where I can access if the dialogue being spoken has PC response menu next or not.
I'm trying to only show the continue button on certain events.
1. When Subtitle typewriter is active = do not show continue button, but allow continueFastFoward for typewriter
2. When Typewriter is done = show continue button, to prompt input
3. IF Typewriter is done, but a PC response menu is next = DO NOT SHOW continue button (because response menu is next).
A little help would be greatly appreciated I tried to get access to the ConversationState.hasPCResponses bool, but I couldn't get it in script--I probably don't know how to access this properly.
However is the best way to approach this, please let me know!
All the best!
Bool for PC Response Menu next or not (Continue Button)
Re: Bool for PC Response Menu next or not (Continue Button)
Hi,
Here's how to get ConversationState.hasPCResponses:
Here's how to get ConversationState.hasPCResponses:
Code: Select all
bool hasPCResponses = DialogueManager.currentConversationState.hasPCResponses;
Re: Bool for PC Response Menu next or not (Continue Button)
Hi Tony,
Thanks so much! Everything is working now, but I get this in the console, referring to the line I get the bool.
"NullReferenceException: Object reference not set to an instance of an object"
Here is my script:
It is attached the highest gameobject in the Dialogue Manager right now. (it was originally attached to the text of the continue button, but i had the same error.)
The Text component is the text component on the continue button.
Thanks for your help!
Thanks so much! Everything is working now, but I get this in the console, referring to the line I get the bool.
"NullReferenceException: Object reference not set to an instance of an object"
Here is my script:
It is attached the highest gameobject in the Dialogue Manager right now. (it was originally attached to the text of the continue button, but i had the same error.)
The Text component is the text component on the continue button.
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using PixelCrushers.DialogueSystem;
public class ContinueButtonHide : MonoBehaviour
{
public Text text;
// Start is called before the first frame update
void Awake()
{
}
private void OnEnable()
{
bool hasPCResponses = PixelCrushers.DialogueSystem.DialogueManager.currentConversationState.hasPCResponses;
if(hasPCResponses)
{
text.text = "";
}
else
{
text.text = ">>";
}
}
private void OnDisable()
{
text.text = "";
}
}
Re: Bool for PC Response Menu next or not (Continue Button)
Hi,
You can either change the OnEnable() method to OnConversationLine(Subtitle subtitle) so it will only be called when showing a subtitle, or you can check if a conversation is active:
You can either change the OnEnable() method to OnConversationLine(Subtitle subtitle) so it will only be called when showing a subtitle, or you can check if a conversation is active:
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using PixelCrushers.DialogueSystem;
public class ContinueButtonHide : MonoBehaviour
{
public Text text;
private void OnEnable()
{
if (!DialogueManager.isConversationActive) return; // <-- ADD THIS
bool hasPCResponses = PixelCrushers.DialogueSystem.DialogueManager.currentConversationState.hasPCResponses;
if(hasPCResponses)
{
text.text = "";
}
else
{
text.text = ">>";
}
}
private void OnDisable()
{
text.text = "";
}
}