Jump to content

[NOT resolved] Loading font error


Recommended Posts

Ok, I've jumped through all the appropriate hoops I can find.  Got my font file created and in the GameData directory.   And, I get this:

[LOG 13:46:35.165] FontLoader: Loaded bundle 'E:\Kerbal Space Program 1.3\GameData\Kerbal Electric\Plugin\kelectricfonts.fnt'
[WRN 13:46:35.168] The referenced script on this Behaviour is missing!
[WRN 13:46:35.169] The referenced script on this Behaviour (Game Object '<null>') is missing!
[ERR 13:46:35.189] FontLoader: Error loading font Could not load file or assembly 'TextMeshPro-1.0.55.2017.1.0b12' or one of its dependencies. The system cannot find the file specified.

I have the fonts in a folder called fonts, the TextMeshProResolver in a folder under that called Editor (nobody said it had to be in a special folder).  The font bundles with no errors.

Obviously, the TMPro I'm using in VS is not the one that's in KSP and I see no DLL in any KSP folder that looks like a correct one to reference.

Ideas?

*Edit

Not sure why but I deleted everything and started with the basic font, created the asset with TMPro then bundled it with PartTools and it loaded fine.

I have noticed that sometimes when I build the package with PartTools the .fnt size would be tiny, like 966 bytes.  Other times, it would seem normal, 19K

Edited by Fengist
Link to comment
Share on other sites

Ok, it's back at it again and I have no idea why.

Nothing in the font creation inside unity is giving any errors.

But, when I put the font in the GameData directory  I still get this:

[LOG 11:46:15.166] FontLoader: Loaded bundle 'E:\Kerbal Space Program 1.3\GameData\Kerbal Electric\Plugin\ehsmb.fnt'
[WRN 11:46:15.169] The referenced script on this Behaviour is missing!
[WRN 11:46:15.170] The referenced script on this Behaviour (Game Object '<null>') is missing!
[ERR 11:46:15.189] FontLoader: Error loading font Could not load file or assembly 'TextMeshPro-1.0.55.2017.1.0b12' or one of its dependencies. The system cannot find the file specified.

I have deleted the KSP font asset and rebuilt them from the TMPro asset.
I've repeatedly updated the assets in the KSP asset builder, repeatedly built the font, repeatedly restarted KSP.
I've moved things around inside Unity so that the TMProResolver is in an Editor folder by itself off of the Assets folder.
I've moved it underneath the 'Fonts' folder in an Editor by itself.
I've moved all the fonts and the Resolver into the editor folder...
I have even stooped to whipping out the hex editor and attempting to change the name of the KSP font asset (font.bytes), which is apparently where this TMPro version is stored.

Nothing seems to work here.

Exactly how do I need to hold my mouth to get a font to load without this error????

Somehow... I have no clue how... I got a font to install itself and it appears to have been placed in resources.assets.  How the hell I got it in there, I have no idea.

Edited by Fengist
Link to comment
Share on other sites

I see a lot of views but not a lot of guesses as to a fix.  So here's more details of the problem.

 I understand what's happening.  Squad purchased a copy of TextMeshPro.  With it, they got the source code.  They chose to imbed the source for TMPro inside the Assets-CSharp.  Sometime after that, TMPro was incorporated into Unity and made free.  Rather than release the paid version and the source code, Unity decided just to create an entirely new version with just the TMPro dll's.  This, according to the TMPro dev, required an entirely new version: http://digitalnativestudios.com/forum/index.php?topic=1471.0

And that new version just happens to be incompatible with the paid version.  To make matters worse, the paid version is apparently going to be kept completely separate from the free version.

So, as modders, we're stuck with a version where we can create these fonts for localization but it's incompatible with the version imbedded in KSP.  When I convert a TMP font asset to a KSP font asset, the TMP version number gets inserted into the KSP font asset file.  I copy it over to the GameData, fire up KSP and it promptly informs me the fonts were built with a different version of TMPro (the free one I have installed in Unity).

Squad is aware of this problem and supposedly there's a fix found on this post: 

Without the script in that post you can't even convert a TMP asset to a KSP asset.

Whether that script comes into play when the font asset is created, I have no idea.  I don't code inside Unity well so I'm not positive of everything that script is doing.

But, somehow, somewhere, I managed to create a KSP font asset from a TMP font asset and KSP loaded it.  I can see it and use it.

I know a number of things have to be just so in order to even create the font asset.  For example, if the script is not in a folder called "Editor", Unity won't find it.  I know if you move that script between folders, Unity seems to lose track of it and you have to restart Unity.  I know sometimes, I've had the asset bundler add the .ttf font file to the bundle even though I can click on it and is says it's not assigned to a bundle.

I've even gone so far as to create an entirely new project with just parttools, TMPro, the fonts and the Resolver script in it and I'm still getting the error.

So... somehow, somewhere, I've got to either lie to the script that compiles the TMPro assets into KSP assets and make it think it's using the version installed in KSP. Lie to KSP and make it think the font was created with a different TMPro or, I've got to somehow compile these assets with the assembly-csharp instead of the TMPro dll's.  

I've apparently managed that once but no idea now how I did.

Edited by Fengist
Link to comment
Share on other sites

3 hours ago, Fengist said:

JPL, what am I doing wrong?

You said yourself what you are doing wrong. The free version is not compatible with the paid one. Nothing can be done about it.

Link to comment
Share on other sites

As Sarbs said. The free version of TMPro is not the same as the paid one. It's on the list of things to work out with Unity... As they have bought TMPro - Hopefully they will sort out the differences over time.
In the meantime try as per the link above.

Link to comment
Share on other sites

  • 5 months later...

I get the same exact error as in the original post, with KSP 1.4.1 / Unity 2017.1.3p1 / PartTools for KSP 1.4.1.

I cannot import a custom font that I've created with the TextMesh Pro from the Unity Asset Store. I understand there's a difference between the TMPro from the Asset Store and the TMPro embedded in KSP's Assembly-CSharp. But is there really no workaround for this yet?

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...