Canvas Controller Life Cycle

Canvas controllers allow you to override certain methods in order to be notified when particular events occur in their life cycle. These include appearance related events, as well as all MonoBehaviour events.

Appearance

A canvas controller can override the following methods to receive appearance related callbacks. These could be used, for example, to trigger an animation once a canvas controller has completely transitioned on screen.

You can use the IsBeingPresented and IsBeingDismissed methods within the callback to infer the cause of the appearance or disappearance.

protected override void CanvasWillAppear()
{
    /*
     *  Override this method in your canvas controller to be notified just
     *  before the canvas is about to transition on screen. This could be
     *  because it is about to be presented or about to dismiss its
     *  PresentedCanvasController.
     */
}

protected override void CanvasDidAppear()
{
    /*
     *  Override this method in your canvas controller to be notified just
     *  after the canvas has transitioned on screen. This could be because
     *  it has just been presented or has just dismissed its
     *  PresentedCanvasController.
     */
}

protected override void CanvasWillDisappear()
{
    /*
     *  Override this method in your canvas controller to be notified just
     *  before the canvas is about to transition off screen. This could be
     *  because it is about to be dismissed or about to present a canvas
     *  controller.
     */
}

protected override void CanvasDidDisappear()
{
    /*
     *  Override this method in your canvas controller to be notified just
     *  after the canvas has transitioned off screen. This could be
     *  because it has just been dismissed or has just presented a canvas
     *  controller.
     */
}

MonoBehaviour

A canvas controller is a MonoBehaviour and as such, all MonoBehaviour callbacks will be called on a canvas controller.

If implementing Awake() or Start(), you should override and call the base implementation like so:

protected override void Awake()
{
    base.Awake();

    // Your awake functionality.
}

protected override void Start()
{
    base.Start();

    // Your start functionality.
}