Activate GameObject on variable condition

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
sentendo
Posts: 15
Joined: Sun Sep 29, 2019 1:38 pm

Activate GameObject on variable condition

Post 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?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Activate GameObject on variable condition

Post 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?
sentendo
Posts: 15
Joined: Sun Sep 29, 2019 1:38 pm

Re: Activate GameObject on variable condition

Post by sentendo »

Hello,
I used Set Game/Objects, pass you a screenshot: https://ibb.co/pK3QXS9
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Activate GameObject on variable condition

Post 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.
sentendo
Posts: 15
Joined: Sun Sep 29, 2019 1:38 pm

Re: Activate GameObject on variable condition

Post by sentendo »

the last solution was the best, thank you very much! As always you are the best.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Activate GameObject on variable condition

Post by Tony Li »

Happy to help!
Post Reply