Forums › 💬 Slate Sequencer › ⚙️ Support › How to add onFinish callback to PlayFromSection?
Hello- I don’t know how to use Lambda’s properly and I’m trying to invoke onFinish from PlayFromSection
I just want to add an option to PlayCutsceneOnStart so it can start from a named section but I also need the onFinish callback(which stops Unity Recorder, great for filmmaking ^_^)
if(SectionNameToPlayFrom != string.Empty)
{
cutscene.PlayFromSection((SectionNameToPlayFrom) => { onFinish.Invoke(); });
}
else
{
cutscene.Play(() => { onFinish.Invoke(); });
}
Need some Lambda help- thanks!
btw- I’ve finished 50 minutes of the film I’m making with Slate so far- Slate is a great filmmaking tool- here’s the second teaser trailer youtube link
Hey, sorry for the late reply. I somehow missed your post :-/
Here is how to use lambda:
|
1 2 3 |
cutscene.Play( ()=> { Debug.Log("Finished"); } ); |
In case of PlayFromSection method, the existing overload that accepts callback requires to also provide a wrapping method parameter:
|
1 2 3 |
cutscene.PlayFromSection( SectionName, Cutscene.WrapMode.Once, ()=> { Debug.Log("Finished"); } ); |
You can alternatively also replace the lambda with a method if that is easier for you. So for example:
|
1 2 3 4 5 6 7 8 9 10 |
void Start(){ cutscene.Play(OnCutsceneFinish); } void OnCutsceneFinish(){ //your code here Debug.Log("Finished"); } |
Let me know if that works for you.
🙂
[quote quote=2242]Hey, sorry for the late reply. I somehow missed your post :-/ Here is how to use lambda: <!– Crayon Syntax Highlighter v_2.7.2_beta –>
</td>
<td class=”crayon-code”>
</td>
</tr>
</tbody>
</table>
<!– [Format Time: 0.0009 seconds] –> In case of PlayFromSection method, the existing overload that accepts callback requires to also provide a wrapping method parameter: <!– Crayon Syntax Highlighter v_2.7.2_beta –>
</td>
<td class=”crayon-code”>
</td>
</tr>
</tbody>
</table>
<!– [Format Time: 0.0002 seconds] –> You can alternatively also replace the lambda with a method if that is easier for you. So for example: <!– Crayon Syntax Highlighter v_2.7.2_beta –>
void OnCutsceneFinish(){
//your code here
Debug.Log(“Finished”);
}
</textarea>
</td>
<td class=”crayon-code”>
</td>
</tr>
</tbody>
</table>
<!– [Format Time: 0.0002 seconds] –> Let me know if that works for you. [/quote]
Works perfectly- thank you!
