Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: yslee on January 13, 2020, 08:14:12 PM

Title: Regarding [Next Frame Event] [SOLVED]
Post by: yslee on January 13, 2020, 08:14:12 PM
Hello,
I found that [Next Frame Event] action is very useful as following link

https://hutonggames.fogbugz.com/default.asp?W349

I understand how to use [Next Frame Event] action from PlayMaker Editor to make a [TRANSITION].
Sometimes it is necessary to trigger a [TRANSITION] from script by sending event.
If I call SendEvent() method, [TRANSITION] happens immediately on a single frame update and sometime it causes a problem.
Therefore it is necessary to [SendEvent] on NEXT FRAME from script like [NEXT FRAME EVENT] action.
I wonder if there is a way to [SendEvent] on NEXT FRAME from script like [NEXT FRAME EVENT] action.
Do I have to write some code to  [SendEvent] on NEXT FRAME from script?
I need your help.
Title: Re: Regarding [Next Frame Event]
Post by: jeanfabre on January 14, 2020, 01:03:39 AM
Hi,

 yes, you can create a one frame delay in script, but it's cumbersome indeed..

you need to use coroutines ( which means you have to be in a monobehaviour script) and yield for one frame.

more explanation below:

https://answers.unity.com/questions/755196/yield-return-null-vs-yield-return-waitforendoffram.html

Bye,

 Jean