Hello Guest

Author Topic: 2d Toolkit deprecated on store  (Read 45352 times)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
2d Toolkit deprecated on store
« on: September 16, 2019, 12:31:25 pm »
Hi all,

I've decided to deprecate 2D Toolkit on the store. As previously mentioned, I will of course support those having migration issues etc. up to Unity 2018.4. I check the forum every so often - but if you need to get in touch email support!

Dinesh
« Last Edit: September 16, 2019, 06:27:44 pm by unikronsoftware »

baconbanditgames

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Bacon Bandit Games
Re: 2d Toolkit deprecated on store
« Reply #1 on: September 16, 2019, 02:36:47 pm »
Any chance of supporting Unity 2018.4? I asked about that in another thread, and you mentioned that you would support up to Unity 2018.4, just double-checking!

2018.4 is important because it's the LTS (Long Term Support) release, and Unity will be properly supporting it with bug fixes, etc. for nearly two more years, which will give a lot of time to move over to the built-in Unity 2D.

Looking at how Unity 2017.4 has been handled for the last few years, there weren't any major changes, just bug fixes, support for necessary things like 64-bit on Android, etc. (none of which would affect 2D Toolkit, probably).
« Last Edit: September 16, 2019, 02:45:56 pm by baconbanditgames »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2d Toolkit deprecated on store
« Reply #2 on: September 16, 2019, 06:28:58 pm »
Any chance of supporting Unity 2018.4? I asked about that in another thread, and you mentioned that you would support up to Unity 2018.4, just double-checking!

2018.4 is important because it's the LTS (Long Term Support) release, and Unity will be properly supporting it with bug fixes, etc. for nearly two more years, which will give a lot of time to move over to the built-in Unity 2D.

Looking at how Unity 2017.4 has been handled for the last few years, there weren't any major changes, just bug fixes, support for necessary things like 64-bit on Android, etc. (none of which would affect 2D Toolkit, probably).

I did mean 2018.4 :) Was a typo

Arnold

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 32
  • Create something you love!
    • View Profile
Re: 2d Toolkit deprecated on store
« Reply #3 on: October 11, 2019, 01:23:24 pm »
Wow, this is the saddest news i had to read in a long time!  :-\

All my games are at least 75% 2DTookit and to lose such an awesome tool in the future, is really sad.
I understand your concerns and i guess there is not much fun in fighting Unity bugs instead of
improving the plugin it self. As other have asked is there any way to send you some money to support
your ongoing support for the older versions?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: 2d Toolkit deprecated on store
« Reply #4 on: October 12, 2019, 02:13:36 pm »
@Arnold - I'm happy to support issues in older versions of unity, no need for any money - Its a shame I couldn't support newer versions of Unity moving forward. 2D Toolkit is a project very dear to me.

I have considered making it open source, if there is any interest in it...

Arnold

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 32
  • Create something you love!
    • View Profile
Re: 2d Toolkit deprecated on store
« Reply #5 on: October 13, 2019, 09:31:50 am »
I'm really curious if open sourcing it would enable a community based continuation of the plugin.
I'm a super novice programmer and always used 2DTK because it is so easy and abstracts away most
of the bullshit you have to put up with Unity's 3D nature or it's 2D implementation.
This kind of community stuff still needs supervising so again i'm not sure how feasible it would be.

Finnegan

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: 2d Toolkit deprecated on store
« Reply #6 on: January 26, 2020, 02:30:27 am »
2D Toolkit is a project very dear to me.

Hi Dinesh, thank you a lot for all the hard work! I worked with 2D toolkit full-time in 2013-2015 and it was a pleasure to use.

Best of luck with your next projects!

habitoti

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
    • Rombos Homepage
Re: 2d Toolkit deprecated on store
« Reply #7 on: April 06, 2020, 02:50:53 pm »
Still happily using it with Unity 2019.3 (just a minor fix for Editor required, which was straightforward and easy). No real alternative to the great platform support (20% of my Android user base still needing a 2x resolution).

That being said: for iOS I could well just go with 4x graphics. What would be a good way to not deliver 2x atlases for iOS, but 2x and 4x for Android?
Checkout our homepage or visit the Rombos blog.

baconbanditgames

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Bacon Bandit Games
Re: 2d Toolkit deprecated on store
« Reply #8 on: April 06, 2020, 04:38:08 pm »
Still happily using it with Unity 2019.3 (just a minor fix for Editor required, which was straightforward and easy). No real alternative to the great platform support (20% of my Android user base still needing a 2x resolution).

That being said: for iOS I could well just go with 4x graphics. What would be a good way to not deliver 2x atlases for iOS, but 2x and 4x for Android?

That's good to hear about 2019.3. You mentioned you needed a minor fix for the editor - could you post that fix here, to help out other people that might need it?

As for 2x, 4x, etc. - I use the following, use at your own risk! Just place the file in an Editor folder in your project.

If your build fails, this will leave any files that it moved in OnPreprocessBuild in /Assets, so you'll need to move them back manually (easy if using source control). If the build completes normally, it will put everything back automatically.

The way it works is that it moves sprite collection files that aren't wanted for a given build, out of Resources folders, so that they are not included in the build, and then it moves them back after the build completes. You can tell it's working as you'll see a reduced build size.

Feel free to use/modify as you see fit.

If anyone has an easier way to handle this, let me know, thanks! Would be great if there was a quick code change we could make somewhere to exclude certain atlas sizes from builds. :)

Code: [Select]
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEngine;

class LocalBuildPrePost : IPreprocessBuildWithReport, IPostprocessBuildWithReport
{
struct Tk2dResourceToRestore
{
public string fileName;
public string pathAndFileNameToRestoreTo;

public Tk2dResourceToRestore(string fileName, string pathAndFileNameToRestoreTo)
{
this.fileName = fileName;
this.pathAndFileNameToRestoreTo = pathAndFileNameToRestoreTo;
}
}

public int callbackOrder { get { return 0; } }

private List<Tk2dResourceToRestore> mTk2dResourcesToRestore;

public void OnPreprocessBuild(BuildReport report)
{
BuildTarget target = report.summary.platform;
string path = report.summary.outputPath;

Debug.Log("LocalBuildPrePost.OnPreprocessBuild for target " + target + " at path " + path);

mTk2dResourcesToRestore = new List<Tk2dResourceToRestore>();

// iterate through all tk2dResource instances in Resources/TK2D so that we can exclude any that include "@1x", "@2x", or whatever we're wanting to exclude
tk2dResource[] tk2dResources = Resources.LoadAll<tk2dResource>("TK2D");

//Debug.Log("Resources/TK2D contents:");
foreach (var resource in tk2dResources)
{
//Debug.Log("resource.name: {0} -> objectReference.name: {1}", resource.name, resource.objectReference.name);

// any objectReference name that contains "@#x" (according to checks below) will get moved to /Assets temporarily (along with the corresponding .meta file), then will get moved back to Resources/TK2D when the build is done
#if UNITY_ANDROID
// keep @2x only
if (resource.objectReference.name.Contains("@1x") || resource.objectReference.name.Contains("@4x"))
#else
// keep @2x, @4x
if (resource.objectReference.name.Contains("@1x"))
#endif
{
string resourceAssetPath = AssetDatabase.GetAssetPath(resource);
string resourceFileName = Path.GetFileName(resourceAssetPath);

string resourceMetaFileAssetPath = resourceAssetPath + ".meta";
string resourceMetaFileName = resourceFileName + ".meta";

// cache this resource and it's original path so that we can restore it after the build
mTk2dResourcesToRestore.Add(new Tk2dResourceToRestore(resourceFileName, resourceAssetPath));

// cache the corresponding meta file
mTk2dResourcesToRestore.Add(new Tk2dResourceToRestore(resourceMetaFileName, resourceMetaFileAssetPath));

// move the file from Resources/TK2D to /Assets
FileUtil.MoveFileOrDirectory(resourceAssetPath, resourceFileName);

// move the meta file from Resources/TK2D to /Assets
FileUtil.MoveFileOrDirectory(resourceMetaFileAssetPath, resourceMetaFileName);
}
}

Debug.Log("moved {0} assets out of /Resources/TK2D temporarily", mTk2dResourcesToRestore.Count);
    }

public void OnPostprocessBuild(BuildReport report)
{
BuildTarget target = report.summary.platform;
string path = report.summary.outputPath;
BuildResult result = report.summary.result;

Debug.Log("LocalBuildPrePost.OnPostprocessBuild for target " + target + " at path " + path + ", result: " + result);
Debug.Log("moving {0} assets from /Assets back to /Resources/TK2D", mTk2dResourcesToRestore.Count);

// iterate through mTk2dResourcesToRestore and move the files back to their original location
foreach (Tk2dResourceToRestore resource in mTk2dResourcesToRestore)
{
// move the file from /Assets to Resources/TK2D
FileUtil.MoveFileOrDirectory(resource.fileName, resource.pathAndFileNameToRestoreTo);
}
}
}
« Last Edit: April 06, 2020, 04:41:40 pm by baconbanditgames »

habitoti

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
    • Rombos Homepage
Re: 2d Toolkit deprecated on store
« Reply #9 on: April 25, 2020, 08:58:11 am »
Hi,

sorry, seems like the forum isn't sending notifications any longer, so I missed your response.
Your code works in principle, however tk2d goes frenzy with lots of missing reference exceptions during the build once part of it's index files where moved out. No clue how this affects the overall build and haven't found how to make tk2d more resilient (and silent) towards a missing platform index file (w/o on the other hand supressing valid errors). It would be great if we'd get some information on where the loop lives that iterates over platforms to move them over to the build folder.Haven't spotted it so far, but then we could just except the unwanted platforms in that loop.

For the camera fix: the way tk2d determines the editor game window size does no longer work, however there is an official way of determining it now, so you just have to replace Editor__GetGameViewSize function in tk2dcamera.cs by:

Code: [Select]
public static bool Editor__GetGameViewSize(out float width, out float height, out float aspect) {
  Vector2 screenSize = Handles.GetMainGameViewSize();
  width = screenSize.x;
  height = screenSize.y;
  aspect = (float)width / (float)height;
  return true;
}
Checkout our homepage or visit the Rombos blog.

baconbanditgames

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Bacon Bandit Games
Re: 2d Toolkit deprecated on store
« Reply #10 on: April 25, 2020, 10:37:35 pm »
Your code works in principle, however tk2d goes frenzy with lots of missing reference exceptions during the build once part of it's index files where moved out. No clue how this affects the overall build and haven't found how to make tk2d more resilient (and silent) towards a missing platform index file (w/o on the other hand supressing valid errors).
That's really strange. I'm using this exact code in two different games, and have done hundreds of builds for them on iOS and Android without any issues. No tk2d code should be running after those files have been moved - they're moved out, build occurs, and they're moved back.

I'm doing this in a Unity 2017.4 project, as well as Unity 2018.4. Both are using the newest version of tk2d.

It would be great if we'd get some information on where the loop lives that iterates over platforms to move them over to the build folder.Haven't spotted it so far, but then we could just except the unwanted platforms in that loop.
There is no code that moves the platform files over to the build folder - they're included in builds because they're in a Resources folder.

For the camera fix: the way tk2d determines the editor game window size does no longer work, however there is an official way of determining it now, so you just have to replace Editor__GetGameViewSize function in tk2dcamera.cs by:

Code: [Select]
public static bool Editor__GetGameViewSize(out float width, out float height, out float aspect) {
  Vector2 screenSize = Handles.GetMainGameViewSize();
  width = screenSize.x;
  height = screenSize.y;
  aspect = (float)width / (float)height;
  return true;
}
Awesome, thanks for the fix, it works great! :)
« Last Edit: April 25, 2020, 11:04:56 pm by baconbanditgames »

habitoti

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
    • Rombos Homepage
Re: 2d Toolkit deprecated on store
« Reply #11 on: April 27, 2020, 08:38:05 pm »
Your explanation makes totally sense, but maybe 2019.3 fires different events or other triggers that makes tk2d get control during the build. It runs into null pointers in like 5-6 different places for every missing index file during the build (which doesn‘t affect the result, though, but is very annoying), however I now just included null pointer checks in those places and now it runs w/o any more complaints ;-)
Checkout our homepage or visit the Rombos blog.

baconbanditgames

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Bacon Bandit Games
Re: 2d Toolkit deprecated on store
« Reply #12 on: April 27, 2020, 09:16:00 pm »
Your explanation makes totally sense, but maybe 2019.3 fires different events or other triggers that makes tk2d get control during the build. It runs into null pointers in like 5-6 different places for every missing index file during the build (which doesn‘t affect the result, though, but is very annoying), however I now just included null pointer checks in those places and now it runs w/o any more complaints ;-)

Ah, yeah that makes sense that Unity 2019 could be doing something different.

Do you mind sharing where you had to include null checks? I'm not using Unity 2019 yet, but probably will upgrade to it in the next few months. Thanks!

habitoti

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 82
    • View Profile
    • Rombos Homepage
Re: 2d Toolkit deprecated on store
« Reply #13 on: April 28, 2020, 04:54:41 pm »
Do you mind sharing where you had to include null checks? I'm not using Unity 2019 yet, but probably will upgrade to it in the next few months. Thanks!

Sure thing:

Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSpriteCollectionData.cs:
Code: [Select]
Line 381 (replace):  public int Count { get { return inst == null ? 0 : inst.spriteDefinitions.Length; } }
Line 578 (replace):  platformSpecificData?.Init(); // awake is never called, so we initialize explicitly

Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSprite.cs
Code: [Select]
Line 69 (insert):  if (collectionInst == null) return;

Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSlicedSprite.cs
Code: [Select]
Line 262 (insert):  if (CurrentSprite == null) return;

Assets/TK2DROOT/tk2d/Code/Sprites/tk2dBaseSprite.cs
Code: [Select]
Line 954 (replace):  if ( Collection != null && Collection.inst != null && GetComponent<Renderer>() != null&& GetComponent<Renderer>().sharedMaterial == null && Collection.inst.needMaterialInstance) {

I am just using Sprites and Sliced Sprites. You might need more if you touch other artefacts also.
Checkout our homepage or visit the Rombos blog.