The Dialogue system launch again with the OnUse trigger
Posted: Sun Jul 26, 2020 11:13 am
Hi,
Thank you for your awesome asset !
I have a problem with the dialogue system and the new input. I can trigger it and It works as intended but if I'm in collision with the gameobject and I close the dialog, the dialog will launch again and I don't know who I can resolve that.
The dialogue trigger is set to OnUse and I launch it when I'm in collision with the gameobject.
I set a variable that will let launch the dialogue if I'm in collision with the gameobject.
If i exit the collision, I set it to false.
The key to launch dialog is the same as making a choice, I think it launch the dialog in the same time as It close the dialog so I think that the problem.
Thank you for your awesome asset !
I have a problem with the dialogue system and the new input. I can trigger it and It works as intended but if I'm in collision with the gameobject and I close the dialog, the dialog will launch again and I don't know who I can resolve that.
The dialogue trigger is set to OnUse and I launch it when I'm in collision with the gameobject.
I set a variable that will let launch the dialogue if I'm in collision with the gameobject.
Code: Select all
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.name == "vThirdPersonCamera")
{
canLaunchDialogue = true;
}
}
Code: Select all
private void OnCollisionExit(Collision collision)
{
if (collision.gameObject.name == "vThirdPersonCamera")
{
canLaunchDialogue = false;
}
}
Code: Select all
void Update()
{
if (joueurGameObject.GetComponent<PlayerInput>().actions["Action1"].ReadValue<float>() == 1 && canLaunchDialogue == true && dialogueManager.GetComponent<PixelCrushers.DialogueSystem.DialogueSystemController>().IsConversationActive == false)
// If the user press Enter with the keyboard or A with a joystick, and the gameobject is in collision, and a dialogue is not launched, the dialog will launch
{
this.gameObject.GetComponent<PixelCrushers.DialogueSystem.DialogueSystemTrigger>().OnUse();
}
}