Hello Guest

Author Topic: tk2dcamera vs unity camera  (Read 4529 times)

kenshin

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
tk2dcamera vs unity camera
« on: August 21, 2013, 06:15:56 am »
Hi,

here is the problem: when I use tk2dcamera I cannot touch tk2duiitembutton but when I use unity camera I can touch them. As i understand, collider of the button is at the different place from the button. because when I click bottom of outside of the button it sense the mouse touch. When I swiitch to scene view I can see the colliders are fitted to button. What can I do to solve this ? Does that mean that tk2d camera doesnt determine touch points correctly ? or ...?

Info:
- tk2dCamera settings: orthographic, ppm = 20, zoom = 10, origin=center
- unitycamera settings: orthographic, size = 1.4, clipping pane= [1.5, 15.01]
- sprite collection ppm = 20

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dcamera vs unity camera
« Reply #1 on: August 21, 2013, 09:19:51 am »
There is a helper function on the tk2dUIItem to Fit the collider to the new button size (its a button in the inspector). You can use that to quickly resize the collider to fit. Does that fix the issue?

kenshin

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: tk2dcamera vs unity camera
« Reply #2 on: August 21, 2013, 11:06:37 pm »
yep, I did it before game start and not worked. then didi it when game running, not worked again. it is strange that on scene view colliedrs are OK but at game view touch is sensed not from collider postion but below the collider position for all buttons.

I have 6 buttons and 2 of them is from the original tk2d UI demo. other 4 buttons are buttons from original ui prefab but button graphic object is replaced with tk2dsprite with animator.
(problem is notices at tk2d 2.1 with hotfix and with 2.2 beta 1 , there is same problem but this time touch is never sensed !)
any suggestion ?

« Last Edit: August 22, 2013, 12:06:01 am by kenshin »

kenshin

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: tk2dcamera vs unity camera
« Reply #3 on: August 22, 2013, 12:11:57 am »
 I have solved :( in tk2dUIManager unity camera is linked... After I link tk2dcamera to ui manager, it has worked !

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dcamera vs unity camera
« Reply #4 on: August 22, 2013, 10:03:14 am »
Yup I was gonna suggest that but you've got it worked out. If you had deleted the camera and not disabled it you'd have found the error straight away.