Hello Guest

Author Topic: Fatal error - font from sprite collection is has an invalid material  (Read 5189 times)

robertwahler

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 8
    • View Profile
Hi,

Could someone help me trouble shoot this error message?  I get dozens on these errors when switching platforms in "build settings".  Stack trace is below.  The errors started when I updated 2d Toolkit to 2.4.0. The error doesn't seem to prevent the game from running. Everything works fine but I'd like to understand the issue. Thanks!

Here is the full stack trace:

Fatal error - font from sprite collection is has an invalid material
UnityEngine.Debug:LogError(Object)
tk2dFontData:Init() (at Assets/Vendor/TK2DROOT/tk2d/Code/Fonts/tk2dFontData.cs:152)
tk2dFontData:get_inst() (at Assets/Vendor/TK2DROOT/tk2d/Code/Fonts/tk2dFontData.cs:130)
tk2dTextMesh:InitInstance() (at Assets/Vendor/TK2DROOT/tk2d/Code/Fonts/tk2dTextMesh.cs:376)
tk2dTextMesh:DoNotUse__CommitInternal() (at Assets/Vendor/TK2DROOT/tk2d/Code/Fonts/tk2dTextMesh.cs:624)
tk2dUpdateManager:QueueCommit(tk2dTextMesh) (at Assets/Vendor/TK2DROOT/tk2d/Code/Runtime/tk2dUpdateManager.cs:30)
tk2dTextMesh:SetNeedUpdate(UpdateFlags) (at Assets/Vendor/TK2DROOT/tk2d/Code/Fonts/tk2dTextMesh.cs:252)
tk2dTextMesh:Init(Boolean) (at Assets/Vendor/TK2DROOT/tk2d/Code/Fonts/tk2dTextMesh.cs:528)
tk2dTextMesh:ForceBuild() (at Assets/Vendor/TK2DROOT/tk2d/Code/Fonts/tk2dTextMesh.cs:755)
tk2dTextMesh:OnEnable() (at Assets/Vendor/TK2DROOT/tk2d/Code/Fonts/tk2dTextMesh.cs:415)
UnityEditor.HostView:OnGUI()

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Fatal error - font from sprite collection is has an invalid material
« Reply #1 on: March 28, 2014, 09:58:35 pm »
So do you just get this when you switch build platforms and nowhere else? Is it specific build platforms that trigger this or everything?

robertwahler

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Fatal error - font from sprite collection is has an invalid material
« Reply #2 on: March 29, 2014, 01:17:00 pm »
It happens switching between any of l the platforms I use, PC/Mac, Android, and iOS.  I get more or less errors depending on what is in the current scene in the editor. If I switch platforms with a blank scene open, I get no errors. 

If I examine the Mesh Renderer component on any of my tk2dTextMeshes, I can see the the Material looks wrong. Instead of saying atlas0 material, I see something like tk2dInternal$.Material_Stones@1x_atlast0 material.  The name of my sprite collection is 'Stones'.  I guess that the file association has been broken in all my text prefabs?  Rebuilding the sprite collection doesn't fix the issue. Any ideas? Thanks for your help.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Fatal error - font from sprite collection is has an invalid material
« Reply #3 on: March 29, 2014, 01:50:47 pm »
The material is fine - its expected for platform collections / when you use png textures.
Whats really bizarre is that I can't reproduce this. Can you create a simple repro case and send to support?


robertwahler

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Fatal error - font from sprite collection is has an invalid material
« Reply #4 on: March 29, 2014, 06:24:23 pm »
I just emailed support a sample project with the error. Thanks for your help.

habitoti

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
    • Rombos Homepage
Re: Fatal error - font from sprite collection is has an invalid material
« Reply #5 on: January 17, 2015, 10:11:02 am »
Hi,
was there any resolution for this? I am just experiencing the same...
Thanks, habitoti
Checkout our homepage or visit the Rombos blog.

habitoti

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
    • Rombos Homepage
Re: Fatal error - font from sprite collection is has an invalid material
« Reply #6 on: January 17, 2015, 07:39:20 pm »
Hi,

I've found one font atlas that caused the whole trouble and prevented the processing of everything else after the platform switch. After opening that atlas in the collection editor and re-committing it, everything went well. So seemingly just some glitch in the course of platform switching...

Thanks, habitoti
Checkout our homepage or visit the Rombos blog.