Hi All,
Can anyone help me get rid of UnityEditor.AssetDatabase from my code? It’s causing issues when trying to build. Right now I have the #endif staving off the build errors, but the text isn’t displaying correctly in the build because of this. It’s just trying to pull the TextMeshPro font I believe.
public TMPro.TMP_FontAsset TMPFont;
[DataMember] public string TMPFontGUID;
[DataMember]
public List parentUIDs;
public List parents;
public abstract void RemoveSelfFromTree();
public abstract void RegisterUIDs();
public virtual void PrepareForSerialization()
{
string guid;
long li;
if (TMPFont != null)
{
#if UNITY_EDITOR
if (UnityEditor.AssetDatabase.TryGetGUIDAndLocalFileIdentifier(TMPFont, out guid, out li))
TMPFontGUID = guid;
#endif
}
else
TMPFontGUID = “”;
}
public virtual void Deserialize()
{
if (!string.IsNullOrEmpty(TMPFontGUID))
{
#if UNITY_EDITOR
string path = UnityEditor.AssetDatabase.GUIDToAssetPath(TMPFontGUID);
TMPFont = (TMPro.TMP_FontAsset)UnityEditor.AssetDatabase.LoadAssetAtPath(path, typeof(TMPro.TMP_FontAsset));
#endif
}
}
}