[Feature Request] OnResume callback on ActionTask

NodeCanvas Forums Support [Feature Request] OnResume callback on ActionTask

This topic contains 3 replies, has 2 voices, and was last updated by  Gavalakis 6 months, 2 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #13260


    I have a custom ActionTask that drives audio/video playback. Is it possible to add an OnResume callback to the ActionTask script so that I can resume playback when the graph is unpaused? I guess I can determine playstate in OnUpdate loop myself but it’d be really handy if there’s a callback function i can directly use just like OnPause.





    For your information, when a graph resumes, the “OnExecute” method is called once again, where you can use it as a resume, possibly even doing some boolean check if required.
    Please let me know if that works for you, or if you need an explicit Resume call.




    An explicit resume callback would be extremely handy, as that enables us to resume timeline playback by subscribing to the event.
    I can modify the graph code to add the callback myself, but I’d prefer to leave the nodeCanvas package intact.



    Hello again,

    I will look into adding an explicit Resume callback. The problem with that though, would be that if I do, I will then also have to remove the OnExecute from being called when the action resumes (which is what happens now), and that might create problems with backwards compatibility, so I will have to make sure this does not happen 🙂
    Until that is done though, you can do something like this for example:

    using NodeCanvas.Framework;
    using ParadoxNotion.Design;
    namespace NodeCanvas.Tasks.Actions{
    	public class Example : ActionTask{
    		private bool paused;
    		protected override void OnExecute(){
    			if (paused){
    				paused = false;
    				//resume code...
    			//normal code...
    		protected override void OnPause(){
    			paused = true;

    Let me know what you think.
    Thank you!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.