Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

[Error] The name 'validateAppearance' does not exist in the current context

A topic by AnthonyUccello created Dec 23, 2019 Views: 60 Replies: 1
Viewing posts 1 to 2
(1 edit)

Hello

After updating I am getting an error when I try to do certain editor functions:


[Error] The name 'validateAppearance' does not exist in the current context


I believe its because of this code:


#if UNITY_EDITOR //just for updating when the editor changes
internal bool validateAppearance = false;
#endif
    public void OnValidate() {

if(font != null && !font.dynamic)
{
if(font.fontSize > 0){
quality = font.fontSize;
}else{
Debug.Log("You're probably using a custom font! \n Unity's got a bug where custom fonts have their size set to 0 by default and there's no way to change that! So to avoid this error, here's a solution: \n * Drag any font into Unity. Set it to be 'Unicode' or 'ASCII' in the inspector, depending on the characters you want your font to have. \n * Set 'Font Size' to whatever size you want 'quality' to be locked at. \n * Click the gear in the corner of the inspector and 'Create Editable Copy'. \n * Now, under the array of 'Character Rects', change size to 0 to clear everything. \n * Now you have a brand new font to edit that has a font size that's not zero! Yeah!");
}
//quality = UseThisFont.fontSize == 0 ? 64 : UseThisFont.fontSize; //for getting around fonts with a default size of 0.
//Debug.Log("Font size is..." + UseThisFont.fontSize);
style = FontStyle.Normal;
}
//apply automatic quality
if(autoQuality)
{
quality = (int)Mathf.Ceil(size);
}
if(size < 0f){size = 0f;}
if(readDelay < 0f){readDelay = 0f;}
if(autoWrap < 0f){autoWrap = 0f;}
if(verticalLimit < 0f){verticalLimit = 0f;}
if(minPitch > maxPitch){minPitch = maxPitch;}
if(maxPitch < minPitch){maxPitch = minPitch;}
if(speedReadScale < 0.01f){speedReadScale = 0.01f;}
        /*
                if(validateMesh)
                {
                    #if UNITY_EDITOR
                    validateAppearance = true;
                    #endif
                }
        */
        validateAppearance = true;
    }


You have code which declares a validateAppearance only in editor but are using it regardless. I think the validateAppearance needs wrapping like this:


#if UNITY_EDITOR
        validateAppearance = true;
#endif


When I did this it fixed the issue.

Developer

Hello!


I have already submitted an update to the asset store to fix this! Keep your eyes out for v1.9.2! For now, yes, that's the exact code change made to solve the issue.