Hello Guest

Author Topic: Dynamic batching broken for flipped objects in Unity 5  (Read 7246 times)

ascreator

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Dynamic batching broken for flipped objects in Unity 5
« on: March 09, 2015, 05:55:34 pm »
Hi,

with Unity 5 the dynamic batching of flipped objects (Scale.X = -1) does not work anymore except for their own 2d Sprites. So whenever some objects, e.g., 2dToolkit Sprites, have a scale below 0, they are completely ignored for batching. This seems to be a bug in Unity itself, since 3d objects have the same problem, but as the dynamic batching works for the Unity 2d Sprites, I hoped that maybe you could fix it for your sprites, too.
Without this bug being fixed, we cannot upgrade to Unity 5 and use its nice new features.  :(

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Dynamic batching broken for flipped objects in Unity 5
« Reply #1 on: March 09, 2015, 11:53:51 pm »
If this is what I think it is, there is nothing we can do until Unity fix it. Please file a bug report with Unity.

ascreator

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Dynamic batching broken for flipped objects in Unity 5
« Reply #2 on: March 10, 2015, 09:41:00 am »
Ok, I did.
But I hoped you maybe could find the reason why it works for the Unity 2d sprites and then reproduce this behavior for the 2d Toolkit spirtes.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Dynamic batching broken for flipped objects in Unity 5
« Reply #3 on: March 10, 2015, 10:41:42 am »
No that isn't really possible. Unity have a special codepath for their own sprites - they're not normal meshes like tk2d sprites.

Nick42

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: Dynamic batching broken for flipped objects in Unity 5
« Reply #4 on: September 19, 2016, 04:46:29 pm »
I'm using Unity 5 and also encountered this issue. And then I tried flipping the tk2d sprite's scale instead of the parent game object's scale and it seemed to have worked so far; dynamic batching did not break anymore. Then I based all the relevant calculations (e.g. left/right direction of movement) using the tk2d sprite's scale instead of the parent game object's. Not sure if this is really a fix, but I'll stick with it for now.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Dynamic batching broken for flipped objects in Unity 5
« Reply #5 on: September 21, 2016, 02:17:27 pm »
Thats the way around it, its also the reason that scale thing went in in the first place... Dynamic batching broke with scales. Batch count isn't as big an issue as it used to be though, so it might be easier to just go with it in some cases to save some (CPU) work.