2D Toolkit > Support
2d Toolkit deprecated on store
baconbanditgames:
--- Quote from: habitoti on April 25, 2020, 08:58:11 am ---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).
--- End quote ---
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.
--- Quote from: habitoti on April 25, 2020, 08:58:11 am ---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.
--- End quote ---
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.
--- Quote from: habitoti on April 25, 2020, 08:58:11 am ---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: ---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;
}
--- End code ---
--- End quote ---
Awesome, thanks for the fix, it works great! :)
habitoti:
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 ;-)
baconbanditgames:
--- Quote from: habitoti 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 ;-)
--- End quote ---
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:
--- Quote from: baconbanditgames on April 27, 2020, 09:16:00 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!
--- End quote ---
Sure thing:
Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSpriteCollectionData.cs:
--- Code: ---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
--- End code ---
Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSprite.cs
--- Code: ---Line 69 (insert): if (collectionInst == null) return;
--- End code ---
Assets/TK2DROOT/tk2d/Code/Sprites/tk2dSlicedSprite.cs
--- Code: ---Line 262 (insert): if (CurrentSprite == null) return;
--- End code ---
Assets/TK2DROOT/tk2d/Code/Sprites/tk2dBaseSprite.cs
--- Code: ---Line 954 (replace): if ( Collection != null && Collection.inst != null && GetComponent<Renderer>() != null&& GetComponent<Renderer>().sharedMaterial == null && Collection.inst.needMaterialInstance) {
--- End code ---
I am just using Sprites and Sliced Sprites. You might need more if you touch other artefacts also.
Navigation
[0] Message Index
[*] Previous page
Go to full version