Using SetEnabled() Command

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
pegassy
Posts: 135
Joined: Sat Mar 17, 2018 8:07 pm

Using SetEnabled() Command

Post by pegassy »

Hello,

I am trying to disable the Mesh Renderer component of an object named "Golden Key", and I am using the following sequence code under Play Sequence Action of Dialogue System Trigger Interactable Target:

SetEnabled(Golden Key, false, Mesh Renderer)

I am getting an error where it says the Golden Key does not have a Mesh Renderer component. I tried it with some other components and get a similar error. What do I seem to be doing wrong?

I tried to follow the same template in the documentation such as:

SetEnabled(AttackAI, false, listener) (Disables the "AttackAI" component on the listener to turn off the listener's attack mode)

I can disable the mesh renderer using the Set Components Enabled/Disabled action, however, I want to change when the disable occurs by adding @time, and I do not think I can do it using just that action.

Thank you for your help.
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using SetEnabled() Command

Post by Tony Li »

Hi,

Flip the parameters, and make MeshRenderer one word:

Code: Select all

SetEnabled(MeshRenderer, false, Golden Key)
pegassy
Posts: 135
Joined: Sat Mar 17, 2018 8:07 pm

Re: Using SetEnabled() Command

Post by pegassy »

Thank you so much.

Is the example in the documentation accurate, or did I just interpret it wrong?
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Using SetEnabled() Command

Post by Tony Li »

They look correct.

The first one is:

Code: Select all

SetEnabled(AttackAI, false, listener)
This disables a component named "AttackAI" on the listener.

The second one is:

Code: Select all

SetEnabled(AttackAI, true, tag=Enemy)
This enables the component named "AttackAI" on all GameObjects tagged "Enemy".
Post Reply