void Awake() { // If the Instance doesn't already exist if (Instance == null) { // If the instance doesn't already exist, set it to this Instance = this; } else if (Instance != this) { // If an instance already exists that isn't this, destroy this instance and log what happened Destroy(gameObject); Debug.LogError("ERROR! The HardwareInfo script encountered another instance of HardwareInfo; it destroyed itself rather than overwrite the existing instance.", this); } // Create the Weights if they do not already exist if (comparisonWeights == null || comparisonWeights.initialized == false) { comparisonWeights = new HardwareComparisonWeights(); } // Create the Reference info from the current config if it does not already exist if (referenceConfiguration == null || referenceConfiguration.initialized == false) { referenceConfiguration = new SimpleHardwareInfo(); } // Create the User info from the current config userConfiguration = new SimpleHardwareInfo(); userConfiguration.SetFromCurrentConfig(); // If we are using complex info, create it from the current info if (useComplexHardwareData) { complexUserConfiguration = new ComplexHardwareInfo(); complexUserConfiguration.SetFromCurrentConfig(); } else { complexUserConfiguration = null; // Otherwise set it to null for GC to deal with it later } // Calculate user score CalculateHardwareScore(); }
// Set and clear reference values public void SetReference() { referenceConfiguration.SetFromCurrentConfig(); }