Hello Guest

Author Topic: Error with 2D Toolkit v2.2.3  (Read 5300 times)

MariusVE

  • Newbie
  • *
  • Posts: 6
    • View Profile
Error with 2D Toolkit v2.2.3
« on: October 17, 2013, 07:22:03 pm »
Hi,

I have purchased 2D Toolkit today (version 2.2.3) and after importing it in Unity, I have received the following error:

Assets/TK2DROOT/tk2d/Editor/Fonts/tk2dFontEditor.cs(165,60): error CS0117: `UnityEngine.TextureFormat' does not contain a definition for `RGBA4444'

I am using Unity 3D Pro v4.0.

Is there a solution for this ?

Thanks!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Error with 2D Toolkit v2.2.3
« Reply #1 on: October 17, 2013, 09:14:22 pm »
Hi,

What version of Unity are you on exactly? I've tested this in Unity 4.0.1f2, 4.1.5f1 and 4.2.1f4.
What version are you running on - perhaps I've missed a version somewhere.

In any case, if you'd like to get running straight away while we resolve this, please edit the file (tk2dFontEditor.cs, line 160) and delete the lines as shown below.

bool IsTextureCompressed(Texture2D texture)
   {
      if (texture.format == TextureFormat.ARGB32
         || texture.format == TextureFormat.ARGB4444
#if !UNITY_3_5
         || texture.format == TextureFormat.RGBA4444
#endif
         || texture.format == TextureFormat.Alpha8
         || texture.format == TextureFormat.RGB24
         || texture.format == TextureFormat.RGB565
         || texture.format == TextureFormat.RGBA32)
      {
         return false;
      }
      else
      {
         return true;
      }
   }


Apologies for the inconvenience.

MariusVE

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Error with 2D Toolkit v2.2.3
« Reply #2 on: October 17, 2013, 10:28:20 pm »
That's the fix I have actually used myself but wasn't sure what the consequences in the long run would be. :)

I am using 4.0.0f7.


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Error with 2D Toolkit v2.2.3
« Reply #3 on: October 17, 2013, 11:28:28 pm »
No consequences, it looks like Unity only added this to the TextureFormat enum after 4.0.x, which is strange to say the least. It should work fine regardless even after you upgrade to a newer version of Unity.

You should replace the code with
#if !UNITY_3_5 && !UNITY_4_0 - thats what we've used. It looks like it works with every 4.x version after 4.0.x.
It'll be in the next update.

MariusVE

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Error with 2D Toolkit v2.2.3
« Reply #4 on: October 18, 2013, 08:51:08 am »
Thank you for your prompt help and for a great tool.