Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - baconbanditgames

Pages: [1]
1
Support / Re: 2d Toolkit deprecated on store
« 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!

2
Support / Re: 2d Toolkit deprecated on store
« 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! :)

3
Support / Re: 2d Toolkit deprecated on store
« 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);
}
}
}

4
Releases / Re: 2D Toolkit 2.5.8.16
« on: September 16, 2019, 07:15:23 pm »
Is there an update to work on 2019.3?

"tk2dCamera.GetGameViewSize - has a Unity update broken this?
This is not a fatal error, but a warning that you've probably not got the latest 2D Toolkit update.

System.NullReferenceException: Object reference not set to an instance of an object
  at tk2dCamera.Editor__GetGameViewSize (System.Single& width, System.Single& height, System.Single& aspect) [0x00021] in D:\Games\Green Sauce Games\Tales of the Orient - The Rising Sun\Assets\TK2DROOT\tk2d\Code\Camera\tk2dCamera.cs:371
UnityEngine.Debug:LogError(Object)
tk2dCamera:Editor__GetGameViewSize(Single&, Single&, Single&) (at Assets/TK2DROOT/tk2d/Code/Camera/tk2dCamera.cs:430)
tk2dCamera:GetScreenPixelDimensions(tk2dCamera) (at Assets/TK2DROOT/tk2d/Code/Camera/tk2dCamera.cs:709)
tk2dCamera:UpdateCameraMatrix() (at Assets/TK2DROOT/tk2d/Code/Camera/tk2dCamera.cs:782)
tk2dCamera:OnEnable() (at Assets/TK2DROOT/tk2d/Code/Camera/tk2dCamera.cs:275)
"

I haven't tested this extensively, but a quick workaround is to update the Editor__GetGameViewSize function with this:

Code: [Select]
public static bool Editor__GetGameViewSize(out float width, out float height, out float aspect) {
width = Screen.width;
height = Screen.height;
aspect = (float)width / (float)height;
return true;
}

This will not work if you select "Free Aspect" - you must select an explicit resolution in the editor.

It does seem to work with any chosen, explicit resolution. I have not checked to see if this has any negative effects, use at your own risk!

Also worth noting that it may not work with how you have your tk2d camera(s) set up!

Note that this error happens in Unity 2019.3+ because Unity removed UnityEditor.GameView.GetMainGameView. As Unity 2019.3 is still in beta, most plugin authors likely haven't looked into this issue. I'm thinking we'll see a more formal solution from the community and/or other plugin authors after 2019.3 is officially released, at which point a proper solution can hopefully be implemented.

5
Support / Re: 2D Toolkit No Longer Supported?
« on: September 16, 2019, 04:06:00 pm »
Yes please! Happy to fix up if I can get a repro :)
support at unikronsoftware.com

Awesome, thanks! I just sent a repro project to you, I was actually able to make the issue occur with a new project in Unity 2018.4.8f1, with only 2D Toolkit imported. Hopefully that helps!

6
Support / Re: 2d Toolkit deprecated on store
« 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).

7
Support / Re: 2D Toolkit No Longer Supported?
« on: September 15, 2019, 04:53:44 pm »
Ran into my first issue.

My project was previously Unity 2017.4.32f1, and I updated it to Unity 2018.4.8f1 and 2D Toolkit v2.5.8.16.

If I edit a prefab that was originally created in Unity 2017, and I modify any tk2d component in the prefab, the changes are not saved in the prefab.

If I modify any non-tk2d component in the prefab after making some changes to tk2d components in the prefab, the tk2d components will be correctly saved/updated in the prefab. So the changes are being recognized, they just aren't triggering a save of the prefab.

If I remove a tk2d component, and add the same component back in (as a new component), it has the same behavior (so I don't think it's necessarily due to the update from Unity 2017 to 2018?).

So far this seems to only be an issue with the tk2d UI components, not the regular components (example: tk2dBaseSprite is fine, but tk2dUIUpDownButton has the bug). Possibly it's only components that have tk2dUIBaseItemControlEditor.cs as a base class?

Only test project I can provide would be a complete copy of my entire game, which I'm willing to do if that would help, just let me know!

8
Support / Re: 2D Toolkit No Longer Supported?
« on: September 12, 2019, 06:31:45 pm »
I updated one of my games to Unity 2018.4.8f1 about a week ago. I updated 2D Toolkit to v2.5.8.16 after I updated Unity.

So far everything works great! I've added sprite collections, modified existing sprite collections (added/removed/modified sprites in them), modified existing prefabs that contain tk2d components, and have been able to do everything I normally can.

The only I don't use is tk2d fonts, as I use Text Mesh Pro.

I did have to change the scripting runtime version to .NET 4.0 - it would be great if it was in the release notes and the forum thread with the v2.5.8.16 download. https://www.2dtoolkit.com/forum/index.php/topic,5607.msg25289.html#msg25289

Will report back if I do run into any issues. :)

9
Support / Re: 2D Toolkit No Longer Supported?
« on: July 29, 2019, 04:55:46 pm »
Hi

I am happy to support until 2018.4. As far as I am aware most of the issues affecting tk2d have been resolved in that version and the latest version
released here works fine in my tests and use cases. Of course with tk2d its an open ended toolkit and you could do so many things with it...

If you upgrade, of course be sensible - version control / backup everything and report any specific issues you're having and I'll try my best to help. Will of course need specific repros to help me find issues quickly.

That's awesome news, thanks for the update!

I'll try updating one of my games to 2018.4 soon (as a completely separate copy, just in case!) and will let you know if I run into any issues.

10
Support / Re: 2D Toolkit No Longer Supported?
« on: July 16, 2019, 06:35:07 pm »
Hi

I am supporting this but Unity updates are making this a very taxing affair. We have to maintain backwards compatibility above everything else and I'm currently working out how much longer it is really viable to continue supporting new Unity updates.

Eg. the prefab update is causing so many problems across the board among so many users, and especially affects us as we use prefabs in a way that is sadly affected. Eg. The 2018 issues were almost totally out of our control, and we were at the mercy of unity to fix the bug. Finding workarounds is costly for us (hours spent trying to work around Unity bugs).

Sorry if this isn't the answer you're looking for but at some point its going to tip over and not worth the effort to keep up to date with unity's constant updates.

What's the current status of 2D Toolkit with Unity 2018.4.x? Are there any show-stopping bugs?

I've got an Android/iOS game built with 2D Toolkit that is going to be released in the next few months, and it's currently using Unity 2017.4.28f1. Unity is stopping support for 2017.4 in early 2020. I expect the game to be updated for at least a year, maybe two, so I'll probably need to update to 2018.4 at some point. I'm hoping that 2D Toolkit will work properly in 2018.4, as that would give me lots of time to transition to using Unity's built-in 2D tools for my next games.

Totally understand if you decide to discontinue support in the near future - I can only imagine how frustrating it is to deal with all of the breaking changes that new Unity versions are introducing! I will say, I'm going to miss 2D Toolkit - it's been great to work with all these years, and still has some features that Unity is missing (sprite dicing being a big one!). Many thanks for all of your hard work on 2D Toolkit. :)

11
Support / Re: Leaving 1x assets out of builds
« on: June 25, 2018, 05:51:41 pm »
Awesome, thank you for the answer!

Got this working, using pre/post process build functions. Tested and working in Unity 2017.4.3f1. Also works with Unity Cloud Build.

Code attached for anyone else that might want to do this (as a file and embedded in the post).

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

class LocalBuildPrePost : IPreprocessBuild, IPostprocessBuild
{
// this class excludes all 1x 2D Toolkit sprite collections from builds

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(BuildTarget target, string path)
{
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"
tk2dResource[] tk2dResources = Resources.LoadAll<tk2dResource>("TK2D");

foreach (var resource in tk2dResources)
{
// any objectReference name that contains "@1x" 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 (so that those files aren't included in the build)
if (resource.objectReference.name.Contains("@1x"))
{
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.LogFormat("Moved {0} assets out of /Resources/TK2D temporarily", mTk2dResourcesToRestore.Count);
        }

//[PostProcessBuildAttribute(1)]
public void OnPostprocessBuild(BuildTarget target, string path)
{
Debug.Log("LocalBuildPrePost.OnPostprocessBuild for target " + target + " at path " + path);
Debug.LogFormat("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);
}
}
}

12
Support / Leaving 1x assets out of builds
« on: June 08, 2018, 11:46:31 pm »
I've been using 1x, 2x, and 4x assets for my sprite collections.

I don't need the 1x assets for any devices any more - is there a way to leave the 1x sprite collection texture and material out of builds?

I can't simply remove all 1x assets from my project at this point as I use the 1x resolution as my design resolution, so it will mess everything up if I try to remove it from the project entirely.

13
Releases / Re: 2D Toolkit 2.5.6
« on: March 18, 2016, 04:52:52 pm »
I'm getting a warning in Unity 5.3.1 (EDIT: 5.3.2f1 as well) and 2D Toolkit 2.5.6.

DontDestroyOnLoad only work for root GameObjects or components on root GameObjects.
UnityEngine.Object:DontDestroyOnLoad(Object)

Double clicking the warning sends me here:

Code: [Select]
public static tk2dSystem inst
{
get
{
if (_inst == null)
{
// Attempt to load the global instance and create one if it doesn't exist
_inst = Resources.Load(assetName, typeof(tk2dSystem)) as tk2dSystem;
if (_inst == null)
{
_inst = ScriptableObject.CreateInstance<tk2dSystem>();
}
// We don't want to destroy this throughout the lifetime of the game
DontDestroyOnLoad(_inst); //<--- This generates the warning!
}
return _inst;
}
}

Line 52 of tk2dSystem.cs

I'm getting the same warning. It happens on older versions of tk2d in Unity 5.3 and newer too.

14
Showcase / Letter Quest Remastered [Steam - Windows/Mac/Linux]
« on: August 13, 2015, 05:39:25 am »
Hi, I'm one-half of the two-man game dev company Bacon Bandit Games. :)

On August 5, 2015 we released Letter Quest Remastered on Steam: http://store.steampowered.com/app/373970

Scrabble meets turn-based RPG!

Spell words to battle monsters, earn gems and use them to purchase upgrades, books, special items, potions, and much more! Letter Quest is a game about using your linguistic skills to survive. It's a turn-based RPG featuring high-res artwork, clever wordplay, and a great soundtrack.



Letter Quest was originally written in Adobe Air, and released on Steam in November 2014. Adobe Air is unable to support Linux, so in January I started porting Letter Quest to Unity, and called it Letter Quest Remastered. I did the whole port over 7 months in my evenings and weekends since I have a full-time day job too.

I used 2D Toolkit, Master Audio, Spine animation software, SRDebugger, DOTween, and Steamworks.NET - I wrote everything else myself, including a lot of small tools to help with porting over 70,000 lines of code from AS3 to C#. :)

The game has been doing well on Steam - it's been featured on the front page since it was released! I also gave the game away for free to all people that owned the original Letter Quest on Steam, and that seems to have gotten a lot of attention/press, thankfully. I somehow managed to luck out and Mr. HeartRocker, a very popular youtuber in Thailand, has done a couple of videos that have a lot of views...an unexpected bonus!

A huge thank you for making 2D Toolkit - it saved me so much time! I wrote a couple of utilities for creating different-sized assets with a few clicks, and a couple of other helpers, and it's the best workflow I've ever used! I can't wait to start working on my next game!

Pages: [1]