Destroy NPC after conversation.
Destroy NPC after conversation.
Is there a convenient way to destroy an NPC after the convo? Or should I assign a script that will activate when the conversation is over that destroys this instance?
Re: Destroy NPC after conversation.
Hi,
If it's sufficient to deactivate the GameObject, you can add a Dialogue System Events component to the NPC. Configure the OnConversationEnd() event to deactivate the GameObject.
If you must destroy it, you could add a script with an OnConversationEnd(Transform) method to it, and destroy the GameObject in that method.
If it's sufficient to deactivate the GameObject, you can add a Dialogue System Events component to the NPC. Configure the OnConversationEnd() event to deactivate the GameObject.
If you must destroy it, you could add a script with an OnConversationEnd(Transform) method to it, and destroy the GameObject in that method.
Re: Destroy NPC after conversation.
Hey thanks for the suggestion above. It worked perfectly in my case. However, now in a different scenario I need to deactivate the object only after a specific dialogue line (I have a key that could be collected and want the object on the scene to deactivate only if the player chooses option "Take key"). Thanks in advance!
Re: Destroy NPC after conversation.
Hi,
Use the SetActive() sequencer command, or a scene event (in the dialogue entry inspector's OnExecute() section).
Use the SetActive() sequencer command, or a scene event (in the dialogue entry inspector's OnExecute() section).