void OnWizardCreate()
    {
        if (Atlas == null || FontXML == null)
        {
            BoltLog.Error("Make sure Atlas and FontXML aren't null");
            return;
        }

        if (PrepareTextures)
        {
            string          atlasPath = AssetDatabase.GetAssetPath(Atlas);
            TextureImporter importer  = (TextureImporter)AssetImporter.GetAtPath(atlasPath);
            importer.textureType    = TextureImporterType.Default;
            importer.mipmapEnabled  = false;
            importer.anisoLevel     = 4;
            importer.filterMode     = FilterMode.Bilinear;
            importer.wrapMode       = TextureWrapMode.Clamp;
            importer.maxTextureSize = 4096;
            //importer.textureFormat = TextureImporterFormat.Alpha8;
            AssetDatabase.ImportAsset(atlasPath, ImportAssetOptions.ForceUpdate);
        }

        TypogenicFont asset = ScriptableObject.CreateInstance <TypogenicFont>();

        asset.Atlas   = Atlas;
        asset.FontXML = FontXML;
        asset.Apply();
        CreateAsset(asset, FontXML.name + " Data.asset");

        if (CreateMaterial)
        {
            Material material = new Material(Shader.Find("Typogenic/Unlit Font"));
            material.mainTexture = Atlas;
            CreateAsset(material, FontXML.name + ".mat");
        }

        AssetDatabase.SaveAssets();
        EditorUtility.FocusProjectWindow();
        Selection.activeObject = asset;
    }
예제 #2
0
 void OnEnable()
 {
     srcFont = (TypogenicFont)target;
 }
 void OnEnable()
 {
     srcFont = (TypogenicFont)target;
 }