private void Awake() { userDisplay = GetComponentInChildren <UserDataDisplay>(); if (userDisplay == null) { SpecialDebugMessages.LogComponentNotFoundError(this, nameof(UserDataDisplay), gameObject); } if (scoreBarPrefab == null) { SpecialDebugMessages.LogMissingReferenceError(this, nameof(scoreBarPrefab)); } CompetenceBarController cbc = scoreBarPrefab?.GetComponent <CompetenceBarController>(); if (cbc == null) { SpecialDebugMessages.LogComponentNotFoundError(this, nameof(CompetenceBarController), scoreBarPrefab); } if (scoreBarsParent == null) { SpecialDebugMessages.LogMissingReferenceError(this, nameof(scoreBarsParent)); } if (nameLabel == null) { SpecialDebugMessages.LogMissingReferenceError(this, nameof(nameLabel)); } if (colors.Length != numberOfScoredProperties) { Debug.Log("Number of colors for the user score bars does not match number of tracked properties. Change the number of defined colors for the bars to " + numberOfScoredProperties, gameObject); return; } for (int i = 0; i < numberOfScoredProperties; i++) { GameObject scoreBarInstance = Instantiate(scoreBarPrefab, scoreBarsParent); CompetenceBarController scoreBar = scoreBarInstance.GetComponent <CompetenceBarController>(); scoreBar.Color = colors[i]; scoreBarInstance.SetActive(false); scoreBars[i] = scoreBar; } }