AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
StartAwareBehaviour.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using System;
5 using UnityEngine;
6 
7 namespace HoloToolkit.Unity
8 {
12  [Obsolete]
13  public abstract class StartAwareBehaviour : MonoBehaviour
14  {
15  #region MonoBehaviour implementation
16 
17  protected virtual void OnEnable()
18  {
19  if (IsStarted)
20  {
21  OnEnableAfterStart();
22  }
23  }
24 
25  protected virtual void OnDisable()
26  {
27  if (IsStarted)
28  {
29  OnDisableAfterStart();
30  }
31  }
32 
33  protected virtual void Start()
34  {
35  IsStarted = true;
36  OnEnableAfterStart();
37  }
38 
39  #endregion
40 
41  protected bool IsStarted { get; private set; }
42 
48  protected virtual void OnEnableAfterStart()
49  {
50  Debug.Assert(IsStarted, "OnEnableAfterStart should only occur after Start.");
51  }
52 
58  protected virtual void OnDisableAfterStart()
59  {
60  Debug.Assert(IsStarted, "OnDisableAfterStart should only occur after Start.");
61  }
62  }
63 }
virtual void OnDisableAfterStart()
This method is similar to Unity's OnDisable method, except that it's called only after Start...
A behaviour designed to help child behaviours take certain actions only after Start has been called...
virtual void OnEnableAfterStart()
This method is similar to Unity's OnEnable method, except that it's called only after Start...