예제 #1
0
        /// <summary>
        /// Checks the setup of the text label and calls UpdateVisuals() for the first time
        /// </summary>
        private void Awake()
        {
            if (!Application.isEditor)
            {
                // check the text label array
                if (textLabels.Length == 0)
                {
                    SpecialDebugMessages.LogArrayInitializedWithSize0Warning(this, nameof(textLabels));
                }

                for (int i = 0; i < textLabels.Length; i++)
                {
                    if (textLabels[i] == null)
                    {
                        SpecialDebugMessages.LogArrayMissingReferenceError(this, nameof(textLabels), i);
                    }
                }
                // check the other components
                if (background == null)
                {
                    SpecialDebugMessages.LogMissingReferenceError(this, nameof(background));
                }
            }

            UpdateVisuals();
        }
예제 #2
0
        /// <summary>
        /// Checks the component setup and initializes the default color array with the current colors of the renderer's materials
        /// </summary>
        private void Awake()
        {
            if (targetRenderers.Length == 0)
            {
                SpecialDebugMessages.LogArrayInitializedWithSize0Warning(this, nameof(targetRenderers));
            }

            defaultColors = new Color[targetRenderers.Length];
            for (int i = 0; i < targetRenderers.Length; i++)
            {
                if (targetRenderers[i] == null)
                {
                    SpecialDebugMessages.LogArrayMissingReferenceError(this, nameof(targetRenderers), i);
                }
                else
                {
                    defaultColors[i] = targetRenderers[i].material.color;
                }
            }
        }