Send Event to Enable/Disable NPC

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
Alatriste
Posts: 181
Joined: Wed Nov 11, 2015 5:07 pm
Contact:

Send Event to Enable/Disable NPC

Post by Alatriste »

Another day, another question... :P

I'm trying to enable/disable an NPC in my background and I wonder if there is an easy way to do it with events instead of using Playmaker, which can make the process much more tedious.

Basically what I try to achieve is that the player can see the NPC in the background, but during a moment of the conversation I will send an event to disable it, as now I'll be using a big portrait and I don't want to have both assets visible at the same time in the screen.

If the NPC was disabled from the start of the conversation there wouldn't be a problem, but what I need is to enable/disable it during some stages of the conversation. I was thinking that attaching some script to the NPC would make the trick, but not sure if this is even possible.

Thanks!
User avatar
Tony Li
Posts: 21721
Joined: Thu Jul 18, 2013 1:27 pm

Re: Send Event to Enable/Disable NPC

Post by Tony Li »

You can use the SetActive() sequencer command:
  • Dialogue Text: "Hello, I'm Fred."
  • Sequence: {{default}}; SetActive(Fred,false)
(The {{default}} means the node should also do its regular sequence in addition to deactivating the GameObject named "Fred".)
User avatar
Alatriste
Posts: 181
Joined: Wed Nov 11, 2015 5:07 pm
Contact:

Re: Send Event to Enable/Disable NPC

Post by Alatriste »

Thanks Tony! I knew that there had to be a simple way to do it. I'll try it as soon as I get home. :)
Post Reply