Author Topic: 3.7.0 breaks 3D menus that work in 3.6.8  (Read 3311 times)

KeithT

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 55
    • View Profile
3.7.0 breaks 3D menus that work in 3.6.8
« on: August 22, 2014, 02:56:26 AM »
Two identical projects the only difference is NGUI 3.6.8 and 3.7.0.
Everything fine in 3.6.8 but 3D menus totally unresponsive in 3.7.0. (2D menus work fine)
UICamera handling the 3D interface is set to 3D World events on both versions.

I saw there was some change in 3.7.0 that events are sent to rigidbodies not colliders any more. Our equipment which does not move does have rigidbodies on their NGUI menus and they have this issue, so probably not that ? Would be interesting to have more explanation what the implications of this change are ?

Any suggestions re cause before diving into heavy debugging ?

(We also have equipment which can be moved (picked up), which also have NGUI menus and these can't have rigidbodies because 2 rigidbodies on a moving gameobject messes up the physics. (We have had to comment out the automatic creation of rigidbodies in UIPanel to get around this). Is this collider to rigidbody change going to mean these don't work any more?)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 3.7.0 breaks 3D menus that work in 3.6.8
« Reply #1 on: August 22, 2014, 04:36:19 AM »
Your issue lies in your event method. You set it to 3D World -- which means that when NGUI does a raycast, the event will go to the first collider hit. There is no depth-based sorting in 3D World type. If you want it to be sorted by widget depth, use 3D UI mode instead.

And yes, in 370 events will go to the rigidbody in 3D World mode. They will go to colliders in 3D UI mode.

World mode is for your game. This would be the mode you'd use on your Main Camera, for example.

KeithT

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 55
    • View Profile
Re: 3.7.0 breaks 3D menus that work in 3.6.8
« Reply #2 on: August 22, 2014, 05:05:05 AM »
Oooof this is huge and breaks our stuff big time.

We have a main camera on an First Person Controller which is the main 3D view and also renders NGUI menus on 3D equipment, we have a 2nd camera which renders 2D HUD/MENU.

Switching UICamera on the FPC camera to 3D UI fixes the menus on 3D equipment not working, but we then don't get any events from interaction with 3D GOs themselves e.g. you should be able to pick things up by mouse press on a 3D object, whereas if you click on a menu on the same object the menu works.

With this new setup how are menus on 3D objects supposed to work ? It seems to be mutually exclusive, either NGUI menus or 3D objects.

KeithT

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 55
    • View Profile
Re: 3.7.0 breaks 3D menus that work in 3.6.8
« Reply #3 on: August 22, 2014, 06:41:16 AM »
Did some more work on this:

We are using the UICamera event system and look at UICamera.lastHit to get details of what has been hit from the main camera, in a class set up as a UICamera.genericEventHandler, which handles all events not handled by NGUI. We use a different layer to differentiate 3D menu events which are handled within the NGUI hierarchy versus other events in 3D space which the genericEventHandler deals with. If UICamera is set to 3D World events the genericEventHandler gets the hit target, if it's set to 3D UI it gets garbage. So this is what breaks 3D interactions if we switch to 3D UI.

The original cause is indeed that because in 3.7.0 in 3D World mode the events are now sent to the GO with the rigidbody, all the existing event handlers we have on NGUI objects with colliders e.g. buttons, no longer get the events, which means to go to 3.7.0 we will have to redo every piece of equipment with an NGUI control interface. Can I ask what this change is for ?

As said below, we have complex 3D objects which contain NGUI control interfaces, that can be moved and therefore have a single rigidbody at the very top level of the GO hierarchy. Having another rigidbody on NGUI panels (as is forced by UIPanel if you don't comment it out) messes with the physics. Sending NGUI events to this top level GO which is outside the NGUI menu hierarchy does not seem to make much sense.



« Last Edit: August 22, 2014, 06:52:31 AM by KeithT »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 3.7.0 breaks 3D menus that work in 3.6.8
« Reply #4 on: August 23, 2014, 02:52:00 AM »
I made this change for Windward. I have complex objects made up of several colliders and enveloped by a trigger sphere that I needed to be clickable. Problem is what events going to colliders was not a good idea as there are a lot of them. Events going to the rigidbody made more sense.

I'll just make it an option for you.

KeithT

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 55
    • View Profile
Re: 3.7.0 breaks 3D menus that work in 3.6.8
« Reply #5 on: August 25, 2014, 01:59:22 AM »
Many thanks, just tried 3.7.1 and the change re events to rigidbodies fixed this.