Author Topic: 'BZA' camera tutorial fail.  (Read 3063 times)

Foj

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
'BZA' camera tutorial fail.
« on: February 05, 2013, 07:19:43 AM »
I am very much a newbie to both Unity and NGUI, I know there are a few posts here relating to multiple cameras but none that seem to deal exactly with my issue,

I have made a super-complex NGUI UI which all works fine. It is intended to be HUD-like staying fixed-to-the-screen as the user moves around a 3D environment – this is where I have come unstuck.

To-date I had not considered the additional camera, the one that will move around the environment. I watched the excellent BZA tutorial ‘NGUI – Multi-Camera Setup’.

The BZA tutorial works fine for me with clean-assets, but when I try to implement it on my existing UI it all goes very wrong.

The only difference I can see between the clean-assets and the retro-implementation is that I have to amend the layer my UI is on: when I used NGUI ‘Create A New UI’ I left the layer at ‘Defaut’, so I am having to name a layer ‘2D_gui’ and then use the drop-down menu in the inspector to change the layer on the ‘UI Root (2D)’ object from ‘Default’ to ‘2D_gui’ - this brings up a dialogue and gets applied to all the children.

So my questions are,
1) Will the retro layer change, I describe above, account for my not getting the BZA method to work with my existing UI?
2) Is the BZA muti-camera setup the only/best way to achieve the second camera?
3) Are there any other good tutorials that explain further the use of multiple cameras with NGUI?

I am an artist moving from UI creation with Flash.

Thank you for all your help in advance.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 'BZA' camera tutorial fail.
« Reply #1 on: February 05, 2013, 10:01:23 AM »
You also need to select your game camera and make sure that it cannot see your 2D_gui layer.

Foj

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: 'BZA' camera tutorial fail.
« Reply #2 on: February 05, 2013, 04:24:18 PM »
Hey, thank you for your reply. It wasn’t quite my question, but I appreciate your time - and everything you’ve done with NGUI! Thank you  ;D

I thought I had followed the BZA tutorial to the letter on several occasions, but just went over it again to air-tight-check the validity of my original mail – and (yep) this time everything worked no problem  :o
(Actually one thing missing from the tutorial is to check the Event Listener Mask on the UICamera script component - although I guess that's only if you move layers maybe)

So in answer to my original question-1, the reason the it did not work before is unknown, but obviously changing the layer is not the issue (probably down to a stupid person pushing the wrong button time after time  :-[ ).

But has anyone still got an answer to my question-3? The BZA tutorial is spot-on, however it would be good to find out even more about using multiple cameras: how and where to use them.

Foj

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: 'BZA' camera tutorial fail.
« Reply #3 on: February 13, 2013, 12:10:37 PM »
OK, so this is ongoing -

Sometimes the 'hud' UI is there and othertimes not, and it only ever appears in Game view, I have never been able to make a build (PC) with the UI appearing (I get the top-left ngui graphic only)

Plus making a build or re-opening the scene always stops the UI appearing even in game-view, and I need to delete the game camera and create a new one before the UI will reappear.

(The test I describe in my first mail, not using my existing UI works fine in game-view and as a build).

Anyone encountered similar issues?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: 'BZA' camera tutorial fail.
« Reply #4 on: February 13, 2013, 01:32:32 PM »
UI disappearing? It may disappear in Unity with versions prior to 4.1 when you recompile scripts, but will reappear again when you force an update, such as by pressing CTRL+S twice.

Foj

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: 'BZA' camera tutorial fail.
« Reply #5 on: February 13, 2013, 05:02:28 PM »
Hey Hello again, and once again thanks for your prompt reply.

I think there's something odd with the UI I created or way I created it. I tried save (ctrl + S) twice an that did not help.

It's if I (save obviously) and reopen the scene or build the scene (both consistently) - and occasionally for no  reason I can see - the UI will stop showing up. As I say no settings are changed. I then need to delete the old game-camera and create a new one to get the UI to show again.   :P

I'll will post some screen grabs tomorrow.