void Awake()
 {
     // Ensure only one instance is running
     if (instance == null)
     {
         instance = this; // Set instance to this object
     }
     else
     {
         Destroy(gameObject); // Kill yo self
     }
     // Make sure the linked references didn't go missing
     if (field == null)
     {
         Debug.LogError("Missing reference to 'field' on <b>SumScoreManager</b> component");
     }
     if (storeHighScore && highScoreField == null)
     {
         Debug.LogError("Missing reference to 'highScoreField' on <b>SumScoreManager</b> component");
     }
     if (dartCountField == null)
     {
         Debug.LogError("Missing reference to 'dartCountField' on <b>SumScoreManager</b> component");
     }
 }
Example #2
0
 /// <summary>Checks and sets references needed for the script</summary>
 /// <returns>True if successful, false if failed</returns>
 static bool MgrSet()
 {
     if (mgr == null)
     {
         mgr = SumScoreManager.instance; // Set instance reference
         if (mgr == null)
         {
             // Throw error message if we can't link
             Debug.LogError("<b>SumScoreManager.instance</b> cannot be found. Make sure object is active in inspector.");
             return(false);
         }
     }
     return(true);
 }