Sequence Message Question..
-
- Posts: 29
- Joined: Sat Jan 02, 2021 4:27 pm
Sequence Message Question..
Hi, I'm trying to use 2 Messages in Custom Sequence like
ChangeLayout()@Message(Start);
SetActive(Noah, True)@Message(Change);
SetActive(Nia, True)@Message(Change);
if i press G key, (start) message sends and ChangeLayout() Method will start, and after ChangeLayout() Finishes,
I have Method (Sequencer.Message("Change")) in ChangeLayout(). so it will send (Change) Message.
I hoped it works but it doesn't work.
SetActive() didn't work.
is there any way to use 2 messages in Sequence??
Thank you
ChangeLayout()@Message(Start);
SetActive(Noah, True)@Message(Change);
SetActive(Nia, True)@Message(Change);
if i press G key, (start) message sends and ChangeLayout() Method will start, and after ChangeLayout() Finishes,
I have Method (Sequencer.Message("Change")) in ChangeLayout(). so it will send (Change) Message.
I hoped it works but it doesn't work.
SetActive() didn't work.
is there any way to use 2 messages in Sequence??
Thank you
Re: Sequence Message Question..
Try this:
This shows that ChangeLayout sends the message Change when it's done, which clarifies when Change is sent.
Make sure ChangeLayout stays active until it's done, and then calls the Stop() method.
Code: Select all
ChangeLayout()@Message(Start)->Message(Change);
SetActive(Noah, True)@Message(Change);
SetActive(Nia, True)@Message(Change);
Make sure ChangeLayout stays active until it's done, and then calls the Stop() method.
-
- Posts: 29
- Joined: Sat Jan 02, 2021 4:27 pm
Re: Sequence Message Question..
Thank you for reply.
Can i call Method which i made CallStop() to call Stop() in Custom SequencerCommand class?
i was about to use Coroutine from this class to other class but i saw it is not good idea.
i call this method 'CameraControl.Instance.ChangeCameraLayout(GetParameter(0));' in Custom SequencerCommand's Awake();
Can i call Method which i made CallStop() to call Stop() in Custom SequencerCommand class?
i was about to use Coroutine from this class to other class but i saw it is not good idea.
i call this method 'CameraControl.Instance.ChangeCameraLayout(GetParameter(0));' in Custom SequencerCommand's Awake();
Re: Sequence Message Question..
Hi,
Sure, that's fine. And coroutines are fine, too.
Sure, that's fine. And coroutines are fine, too.
-
- Posts: 29
- Joined: Sat Jan 02, 2021 4:27 pm
Re: Sequence Message Question..
ChangeLayout()@Message(Start)->Message(Change);
SetActive(Noah, True)@Message(Change);
SetActive(Nia, True)@Message(Change);
I just used this Method and it doesn't send Message(Change).
i used coroutine in Custom SequencerCommand's Start() Method but Coroutine just turns off.
My Continue Button sends Message(Start) and SequencerCommandChangeLayout starts, and it calls Coroutine in Start(),
and Coroutine has Stop() like this.
IEnumerator Coroutine()
{
while(true)
{
Debug.Log("11"); <-- when i start coroutine, it calls this 2 times and just turns off coroutine.
if( ~~~ )
{
Stop();
}
yield return new WaitForFixedUpdate();
}
}
i don't know why coroutine stops..
++ I think if i move to next dialogue Text, SequencerCommands stop.
SetActive(Noah, True)@Message(Change);
SetActive(Nia, True)@Message(Change);
I just used this Method and it doesn't send Message(Change).
i used coroutine in Custom SequencerCommand's Start() Method but Coroutine just turns off.
My Continue Button sends Message(Start) and SequencerCommandChangeLayout starts, and it calls Coroutine in Start(),
and Coroutine has Stop() like this.
IEnumerator Coroutine()
{
while(true)
{
Debug.Log("11"); <-- when i start coroutine, it calls this 2 times and just turns off coroutine.
if( ~~~ )
{
Stop();
}
yield return new WaitForFixedUpdate();
}
}
i don't know why coroutine stops..
++ I think if i move to next dialogue Text, SequencerCommands stop.
Re: Sequence Message Question..
Hi,
Also, Start can be a coroutine. Example:
p.s. - To show in your forum posts, use [ code ] ... [ /code ].
Yes, that's correct. If you move to the next dialogue entry, the current dialogue entry's sequence will stop. If you are moving to the next entry before the sequence has finished, use the 'required' keyword to guarantee that the SetActive() commands run anyway:wlchfl5359 wrote: ↑Tue Jan 12, 2021 10:32 amI think if i move to next dialogue Text, SequencerCommands stop.
Code: Select all
ChangeLayout()@Message(Start)->Message(Change);
required SetActive(Noah, True)@Message(Change);
required SetActive(Nia, True)@Message(Change);
Code: Select all
public class SequencerCommandChangeLayout : SequencerCommand
{
IEnumerator Start()
{
while(true)
{
if( ~~~ )
{
Stop();
yield break; // REMEMBER TO STOP YOUR COROUTINE, TOO!
}
}
}
}
-
- Posts: 29
- Joined: Sat Jan 02, 2021 4:27 pm
Re: Sequence Message Question..
Thank you for reply.
I used 'required' and it works
it calls SetActive(), but Coroutine stops if i move next dialogue entry.
Is there no way to keep Coroutine live?
I used 'required' and it works
Code: Select all
ChangeLayout(Village)@Message(Start)->Message(Change);
required SetActive(House State 0)@Message(Change);
required SetActive(Ayanna, true)@Message(Change);
Is there no way to keep Coroutine live?
Code: Select all
IEnumerator Start()
{
while(true)
{
if(~~)
{
Debug.log("here"); <- it can't be reach this point if i move next dialogue entry..
Stop(); <- i need SetActive() works after here.
Yield break;
}
yield return new WaitForFixedUpdate();
}
}
Re: Sequence Message Question..
If you really need to keep a coroutine going, start a coroutine outside of the sequencer command. Example:
Code: Select all
public class SequencerCommandChangeLayout : MonoBehaviour
{
IEnumerator Start()
{
// Start a coroutine on another GameObject:
SomeOtherGameObject.StartCoroutine(SomeOtherScript.SomeCoroutine());
// Then stop this command when appropriate:
while (keepGoing)
{
yield return null;
}
Stop();
}
}
-
- Posts: 29
- Joined: Sat Jan 02, 2021 4:27 pm
Re: Sequence Message Question..
Thank you very much for help
I modified script, so i made Continue Button can't work until method in other script is finish, and dialogue doesn't move to next dialogue and SequencerCommand is not dying.
So i can send message(Change) from other script.
It was very helpful to use this asset. Thank you!!
I modified script, so i made Continue Button can't work until method in other script is finish, and dialogue doesn't move to next dialogue and SequencerCommand is not dying.
So i can send message(Change) from other script.
It was very helpful to use this asset. Thank you!!
Re: Sequence Message Question..
Happy to help!