Page 1 of 1

custom sequencer command access to scene elements

Posted: Fri Dec 22, 2023 3:07 pm
by perezbalen
Hi
I'm trying to do a custom sequencer command. The Youtube video tutorial explains the basics and it seems very straightforward, and I managed to get the thing mostly working. But I can't figure out how to connect to scene elements. I mean, Let's say I have an object of type door which inside has a OpenDoor() method. Normally I would

Code: Select all

public Door door;
...
door.OpenDoor();
but my question is, how do I assign the door at the end of the level to this? Using the editor, I would drag and drop said object to the script Door field. But how do I do that with a custom sequencer command?
And also, how do I do this for a scriptable object that is not in the scene?
Thanks.

Re: custom sequencer command access to scene elements

Posted: Fri Dec 22, 2023 7:18 pm
by Tony Li
Hi,

Sequencer commands don't have direct references to scene objects or assets (e.g., ScriptableObject assets). If you absolutely must have a direct reference, use the dialogue entry's OnExecute() UnityEvent. But only do this if you're going to be working entirely in Unity. External editors such as articy:draft and Arcweave can't directly reference Unity objects of course.

The way to do it with sequencer commands is by name reference or by special keyword. If the door GameObject (see Character GameObject Assignments) is the dialogue entry's speaker, use the keyword 'speaker'. If the door is the listener, use the keyword 'listener'. Otherwise specify the door's GameObject name -- or actor name if the door has a Dialogue Actor component. In your sequencer command, you can use the GetSubject() method to get the GameObject. In fact, for the example you provided, you don't need to write a custom sequencer command. You can use SendMessage(). Say the door is the listener for a player dialogue entry "[open door]". Use this sequencer command:

Code: Select all

SendMessage(OpenDoor,,listener)