Page 1 of 1

Activate GameObject on variable condition

Posted: Tue Oct 22, 2019 6:22 pm
by sentendo
Hello,
I am trying to activate a GameObject, part of my Canvas (RectTransform) after the value of a variable is equal to true.

First of all I set the new variable in my database.

Then I have a game objects which controls the game with the Dialogue System Trigger component attached. So, after the action "Start Conversation" with the actual dialogue, I place a "Set GameObject Active/Inactive". I put there my Canvas->Gameplay object, but the script just takes out the Rect Transform component and I suppose it activate/deactivate it.

I would like to enable/disable the whole GameObject, is it possible with this component?

Re: Activate GameObject on variable condition

Posted: Tue Oct 22, 2019 8:10 pm
by Tony Li
Hi,

The "Set GameObjects Active/Inactive" action should activate the entire GameObject (as long as the Condition is true).

Did you perhaps use the "Set Components Enabled/Disabled" action instead?

Re: Activate GameObject on variable condition

Posted: Thu Oct 24, 2019 4:14 am
by sentendo
Hello,
I used Set Game/Objects, pass you a screenshot: https://ibb.co/pK3QXS9

Re: Activate GameObject on variable condition

Posted: Thu Oct 24, 2019 8:44 am
by Tony Li
Thank you for posting the screenshot. The Dialogue System Trigger's Set GameObjects Active/Inactive action will only check the Condition once, when the trigger starts. It will not continuously check it during the conversation.

If you want to set the GameObject active at the point in the conversation that you set a variable true, use the SetActive() sequencer command in the dialogue entry node where you set the variable true.

However, I see that the variable is named "DialogueEnded". If you want to set "Gameplay" active when the conversation ends, add a Dialogue System Events component. Configure the OnConversationEnd event to activate Gameplay. This way you don't have to use any variables.

Re: Activate GameObject on variable condition

Posted: Thu Oct 24, 2019 12:31 pm
by sentendo
the last solution was the best, thank you very much! As always you are the best.

Re: Activate GameObject on variable condition

Posted: Thu Oct 24, 2019 1:06 pm
by Tony Li
Happy to help!