a gc issue about Tweener.ChangeEndValue.
« on: May 25, 2015, 10:05:50 AM »
hi there
I have a issue about Tweener.ChangeEndValue.
I use this to make camera follows the main character with code like:
if(mMoveTween == null){
mMoveTween = m_Tran.DOMove(m_CameraLocation.position,0.5f).OnKill(()=> mMoveTween = null);
}else if(mMoveTween.IsPlaying()){
mMoveTween.ChangeEndValue(m_CameraLocation.position,true);
}else
{
mMoveTween = m_Tran.DOMove(m_CameraLocation.position,0.5f);
}
the variable "mMoveTween" is the preference i kept in the class.meenwhile i set the recycleAllByDefault be true when init.
DOTween.Init(true, true, DG.Tweening.LogBehaviour.Default);
the question is when I run the game. there always are 20b GC allocations in unity profiler.how dose this happen? I think the mMoveTween should be reused without any gc.
i'm looking forward to your answers , thx.

*

Daniele

  • Dr. Admin, I presume
  • *****
  • 378
    • View Profile
    • Demigiant
Re: a gc issue about Tweener.ChangeEndValue.
« Reply #1 on: May 25, 2015, 01:19:14 PM »
Hello,

Those 20B of allocation happen because when using ChangeStart/End/Values the change value is boxed as an object rather than as its true value type. That is sadly a necessity, because generic types can't be converted with AOT (iOS). The only other solution would be for me to add a ChangeStart/End/Values overload for each value type, but that would make every Tweener instance much heavier, so I believe that 20B per call are much better.

Re: a gc issue about Tweener.ChangeEndValue.
« Reply #2 on: May 25, 2015, 01:37:14 PM »
thanks for your help.