how to delete notification and receiver?

I know that unity timeline have interface below:

PlayableOutput.AddNotificationReceiver
TimeNotificationBehaviour.AddNotification

they accept time parameter both.
They work on editor mode, but unfortunately I did not find any interface about [deleting] notification.
Why I need these interface?
1 I want trigger event on every clip at begin or end by code, and I don’t need do it by adding marker on timeline editor manually.
2 I wish to loop at specific clip.
3 I do not want to create a notification every time for reducing gc.
any help, please.

There’s RemoveNotificationReceiver.

Thanks for reply. The output can remove the receiver, But one receiver will be invoke by many notification. I will not receive the other notification if I remove the receiver. so it would be perfect if I could remove nofifications on the behaviour. I still can’t find any interface on the behaviour that can remove nofications.

I also can’t find any deleting function too; another solution is to add a IsInvalid flag field to all notifications, and when you don’t want the notification to be processed, turn the IsInvalid flag on. In the receivers, if the flag of the notification is on, just don’t process and return. This implementation also matches your needs that “I do not want to create a notification every time for reducing GC”.

I resolve it by create one custom NotificationBehaviour myself. You create one Custom Notification Track, and listen to it’s Behaviour interfaces (OnGraphStart, ProcessFrame…). In this way, you take over all of details, so you can get rid of gc.
Take care of PlayableDirector [Manual] mode. the [ProcessFrame] never be called at last frame. [OnGraphStop/OnPlayableDestroy] never be called under manual mode.

Thanks for reply. It is one solution indeed. I resolve it by create on custom notifcation track currently, and it give me more flexibility.

You will find that TimeNotifycationBehaviour of unity create one new list of notification every time playable created if you dig into the code. It seems that you have to create your own notication behaviour to avoid this case.
It will be OK in the most of case because a timeline play several seconds, gc only happen at beginning.

1 Like