Author Topic: 2D UI vs 3D UI UICamera  (Read 7391 times)

Tatanan

  • Jr. Member
  • **
  • Thank You
  • -Given: 11
  • -Receive: 0
  • Posts: 81
    • View Profile
    • Casual Arena
2D UI vs 3D UI UICamera
« on: September 18, 2014, 05:11:26 AM »
I usually work with UICamera with Event Type = 2D UI, since my game and interface are fully 2D.
However your default prefabs (like checkbox...) are not working to me with 2D UI. However, when switching to 3D UI, it start working.
Why? Which is the reason?

and

How should I set up the UI Camera?

Thank you.
Game developer on Casual Arena.

Tatanan

  • Jr. Member
  • **
  • Thank You
  • -Given: 11
  • -Receive: 0
  • Posts: 81
    • View Profile
    • Casual Arena
Re: 2D UI vs 3D UI UICamera
« Reply #1 on: September 18, 2014, 05:41:31 AM »
I think I have a partial response:
It seems 2D camera need 2D colliders and 3D camera need 3D colliders?
Is it exactly that?
Game developer on Casual Arena.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 2D UI vs 3D UI UICamera
« Reply #2 on: September 18, 2014, 03:39:57 PM »
UICamera's event type determines what type of events are sent out. If it's set to 3D, then Physics.Raycast will be used, hitting Collider objects. If it's 2D, then Physics2D will be used instead, hitting BoxCollider objects. Whether it's UI or World then determines how the results are sorted. If it's UI, then all hits are sorted by widget depth. If it's World, then it's just as-is, based on the Z position.

Tatanan

  • Jr. Member
  • **
  • Thank You
  • -Given: 11
  • -Receive: 0
  • Posts: 81
    • View Profile
    • Casual Arena
Re: 2D UI vs 3D UI UICamera
« Reply #3 on: September 19, 2014, 03:19:44 AM »
Ok, but in practise, how does this affect?
It seems 2D camera need 2D colliders and 3D camera need 3D colliders?
Is it exactly that?

I'm asking because your prefabs are not working on my scene and maybe it's just because your prefabs are using 3D colliders or something like that.

Thank you
Game developer on Casual Arena.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 2D UI vs 3D UI UICamera
« Reply #4 on: September 19, 2014, 08:30:54 PM »
?

I've already explained it in the previous post. UICamera's Event Type determines whether 2D or 3D colliders are used.

UnityEngine.Camera type (ortho / perspective mode) has no effect.