UILabel.AssumeNaturalSize C# (CSharp) Méthode

AssumeNaturalSize() public méthode

Make the label assume its natural size.
public AssumeNaturalSize ( ) : void
Résultat void
	public void AssumeNaturalSize ()
	{
		if (ambigiousFont != null)
		{
			mWidth = 100000;
			mHeight = 100000;
			ProcessText(false);
			mWidth = Mathf.RoundToInt(mCalculatedSize.x * pixelSize);
			mHeight = Mathf.RoundToInt(mCalculatedSize.y * pixelSize);
			if ((mWidth & 1) == 1) ++mWidth;
			if ((mHeight & 1) == 1) ++mHeight;
			MarkAsChanged();
		}
	}

Usage Example

Exemple #1
0
        private void SwitchCheck()
        {
            if (mLabel == null)
            {
                return;
            }

            mLabel.effectStyle    = UILabel.Effect.Outline;
            mLabel.effectDistance = 0.5f * Vector2.one;

            Color tempColor = Color.white;

            tempColor.r = 46f / 255f;
            tempColor.g = 78f / 255f;
            tempColor.b = 103f / 255f;

            mLabel.effectColor = tempColor;

            tempColor.r = 1f;
            tempColor.g = 213f / 255f;
            tempColor.b = 104f / 255f;

            mLabel.color = tempColor;

            if (mLabel.fontSize != 26)
            {
                mLabel.fontSize = 26;
                mLabel.AssumeNaturalSize();
            }
        }
All Usage Examples Of UILabel::AssumeNaturalSize