Hello Guest

Author Topic: tk2dUITime.deltaTime problem  (Read 6146 times)

hasean

  • Newbie
  • *
  • Posts: 6
    • View Profile
tk2dUITime.deltaTime problem
« on: September 20, 2013, 08:23:30 am »
Hello. I'm using AnimateShowWindow() in my project. That function also call coTweenTransformTo() where calculates the speed of transforming using tk2dUITime.deltaTime.
At first scene start everything works great, the problem begins after load new or reload scene.
For ex: First scene start, my player reached finish collider and a window with totals appears in 0.5f at this moment tk2dUITime.deltaTime equals ~0.013 and everything is ok. Then I press retry button and scene reloads with Application.LoadLevel(Application.loadedlevel) at this moment tk2dUITime.deltaTime still equals ~0.013, then my player get in collision with finish collider again, and at this moment tk2dUITime.deltaTime become equals ~1-9, and window with totals appears very very very slowly.
Dear 2dToolKit team pls advise. Of course I can replace tk2dUITime.deltaTime with 0.013f, i tried it and it works good, but i'm not sure this is professional solving the problem.
Thx!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dUITime.deltaTime problem
« Reply #1 on: September 20, 2013, 09:54:02 am »
Hmm... Do you have 2 uimanagers in the scene when this happens? Theres a bug in 2.2 where a second UI manager may exist and isn't deleted properly. In tk2dUIManager.cs, add the line in bold:


            //can only be one tk2dUIManager at one-time, if another one is found Destroy it
            if (instance != this)
            {
                Debug.Log("Discarding unnecessary tk2dUIManager instance.");
                Destroy(this);
                return;
            }

hasean

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: tk2dUITime.deltaTime problem
« Reply #2 on: September 20, 2013, 10:25:53 am »
Yes, when scene reloads Gameobject with tk2dUIManager duplicates. After adding Destroy(this); GameObject still duplicates but without tk2dUIManager.cs component and UI Buttons stop working... :(

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dUITime.deltaTime problem
« Reply #3 on: September 20, 2013, 10:29:08 am »
Do you have a tk2dUICamera script attached to your camera? That is the preferred way to work with this in tk2d 2.2 -  in most cases you don't need the kt2dUIManager at all. Try attaching that - I'll investigate trying to deal with this in a more robust way.

hasean

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: tk2dUITime.deltaTime problem
« Reply #4 on: September 20, 2013, 10:56:23 am »
I use your tk2dCamera and it is hooked up in uimanager. Do you suggest to remove this camera, create unity usual camera nad attach tk2dUICamera to it and delete uimanager? Am i right?

hasean

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: tk2dUITime.deltaTime problem
« Reply #5 on: September 20, 2013, 11:17:27 am »
Seems that solves the problem. But what about setting that were in tk2dCamera?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dUITime.deltaTime problem
« Reply #6 on: September 20, 2013, 11:45:13 am »
tk2dUICamera is just something to tell the UI system that the camera is used for UI. You can attach it to a tk2dCamera, or a normal camera even a perspective camera if you'd like. Its independent to the tk2dCamera script.