Page 1 of 1

SetActive() question

Posted: Wed Feb 13, 2019 9:08 am
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?

Re: SetActive() question

Posted: Wed Feb 13, 2019 9:42 am
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}}.

Re: SetActive() question

Posted: Wed Feb 13, 2019 9:53 am
by FunD
Awesome, thanks so much!

Re: SetActive() question

Posted: Wed Feb 13, 2019 10:19 am
by Tony Li
Glad to help!