SetActive() question

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
FunD
Posts: 27
Joined: Tue Feb 12, 2019 6:14 am

SetActive() question

Post by FunD »

Hi :)

I want to have an object appear in my scene, after a dialogue is completed.
I already found out that SetActive() needs to be added in the 'Sequence' in the Inspector (http://www.pixelcrushers.com/dialogue_s ... dSetActive)

However, I'm still a newbie in programming and not executing it right, because it's not working. The object is currently inactive in the scene, however its parent is an active empty game Object (am I doing this right?). And I entered SetActive(gameObject,[true]) in the 'Sequence'.

I'm a bit confused about 'gameObject': do I need to leave it written like this, or do I need to enter the tag of the game object or the name? Or does it automatically know which gameObject is inactive in the scene and goes to look for that?
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: SetActive() question

Post by Tony Li »

Hi,

You're almost there. Let's say the GameObject is named "Force Field" (without quotes). Put this command in the Sequence field:

Code: Select all

SetActive(Force Field, true)
A subtitle will display for as long as its Sequence runs. The command above runs immediately. It doesn't take any time. This means the subtitle will only flash onscreen briefly. You may want to set the Sequence field to:

Code: Select all

SetActive(Force Field, true);
{{default}}
This will pull in the Dialogue Manager's Default Sequence, which is typically set to delay for a duration based on text length.

Note also that you don't necessarily have to type any of this. If you drag a GameObject from the Hierarchy onto the Sequence field, it will add the SetActive command for you. Similarly, if you click "+", you can select the menu option to add {{default}}.
FunD
Posts: 27
Joined: Tue Feb 12, 2019 6:14 am

Re: SetActive() question

Post by FunD »

Awesome, thanks so much!
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: SetActive() question

Post by Tony Li »

Glad to help!
Post Reply