The function does work. Given an ASCII or Unicode font, `GenerateEditableFont` will make you a copy of it, so you can edit the bitmap texture. I'm not sure why you are using Resources - that is really a runtime thing and not an editor thing. Code like this worked for me:
using UnityEngine;
using UnityEditor;
public class FontManager : MonoBehaviour {
[MenuItem ("Assets/Make Editable Font")]
static void Fontie()
{
UnityEngine.Object f = AssetDatabase.LoadMainAssetAtPath("Assets/Sathu.ttf");
string path = AssetDatabase.GetAssetPath(f);
Debug.Log("Generating copy of: " + path);
TrueTypeFontImporter fontImporter = AssetImporter.GetAtPath(path) as TrueTypeFontImporter;
fontImporter.GenerateEditableFont("Assets/Sathu2.ttf");
}
}
Note that the files that are created are written into the Assets folder, since they are copies of assets.
↧