ForceGetComponent() public static method

Force to get a component, if not found we will add one then.
public static ForceGetComponent ( MonoBehaviour mb ) : T
mb MonoBehaviour Any MonoBehaviour.
return T
Beispiel #1
0
        /// <summary>
        /// Show the resize panel, for debugging usage.
        /// </summary>
        public void ShowResizePanel()
        {
            if (mImage == null)
            {
                mImage = JCS_Util.ForceGetComponent <Image>(this);
            }
            else
            {
                if (mShowResizePanel && mImage.enabled)
                {
                    return;
                }
            }

            // Show it.
            mImage.enabled = true;

            // Set image. Just a white sprite!
            mImage.sprite = mImageSprite;

            // Set color.
            mImage.color = mResizePanelColor;

            mShowResizePanel = true;
        }
Beispiel #2
0
        /* Functions */

        private void Awake()
        {
            if (mTextContainer == null)
            {
                mTextContainer = this.GetComponentInChildren <Text>();
            }

            mDistanceTileAction = JCS_Util.ForceGetComponent <JCS_3DDistanceTileAction>(mTextContainer);
        }