Remove observer from ObservableFinished
tdapper last edited by
I am creating a job that does some potentially long-ish computation in a queue in the background. To that job I added an finish observer like this:
_jobvariable in this example is of type
WatchGeneratorFinished()observer function just fires an
EventAdd()when the job finishes, which is usually what I want. There are, however, certain events in the scene that I am listening to which indicate that this is not the behavior I want (e.g. an editor render being kicked off) in which case I would like to remove the observer (to potentially add it back again later). I did find a function
ObservableBaseInterface::RemoveObserver(), which appears to do what I want, but I am having a hard time finding out how to use it. The
ObservableFinishedBaseobject that is returned from JobResultRef<>::ObservableFinished()` function I am using does not seem to implement it. Is there a way for me to do this?
Any pointers very much appreciated!
a simplified snippet on how you are implementing your job would be much appreciate.
I've asked the dev and it's not supported.
Be aware that you could be in the position where you are trying to remove the observer but it has already been called.
The suggestion is to create a local bool variable to know if you want the observer to be executed.
i'll set that thread as solved.