Exemple #1
0
 void OnDestroy()
 {
     // If this component is registered as the main FadeInOnStart component, the reference should now be removed
     if (instance == this)
     {
         instance = null;
     }
 }
Exemple #2
0
 void Awake()
 {
     if (instance != null)
     {
         // If the instance variable is not null, there is already a FadeInOnStart component in the scene.
         // In that case, show a warning message
         Debug.LogWarning("Multiple FadeInOnStart components found, it can be unpredictable which one is used. " +
                          "It is recommended to have only one FadeInOnStart component in your scene.");
         return;
     }
     // If this is the first FadeInOnStart component for which Awake is called, register it as the main instance
     instance = this;
 }