Page 1 of 1

Using SetEnabled() Command

Posted: Fri Dec 21, 2018 1:18 pm
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.

Re: Using SetEnabled() Command

Posted: Fri Dec 21, 2018 2:00 pm
by Tony Li
Hi,

Flip the parameters, and make MeshRenderer one word:

Code: Select all

SetEnabled(MeshRenderer, false, Golden Key)

Re: Using SetEnabled() Command

Posted: Sat Dec 22, 2018 2:03 pm
by pegassy
Thank you so much.

Is the example in the documentation accurate, or did I just interpret it wrong?

Re: Using SetEnabled() Command

Posted: Sat Dec 22, 2018 3:02 pm
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".