Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Foj

Pages: [1]
1
Hi, does anyone know of a really good (artist + limited C#) explanation of hiding and un-hiding NGUI UI elements?

I am using - probably very inefficiently - NGUITools.SetActive(true/false). It has taken me half a day to understand that I need to leave a GameObject higher up the hierarchy 'active' to be able set 'false' items back to 'true' - this is the level I am working at  :-[

Any help with writing better code will be much appreciated. Thank you.

  1. public class display : MonoBehaviour {
  2.  
  3.         public static GameObject selectNpc01Message;
  4.  
  5.         void Start(){
  6.         }
  7.                
  8.         void Update() {
  9.                 if (GetComponent<triggerNpc01>().triggerActiveNpc01 == true){
  10.                         selectNpc01Message = GameObject.Find("selectNpc01");
  11.                         NGUITools.SetActive(selectNpc01Message,true);
  12.                         if (Input.GetKeyDown("space")){
  13.                         Debug.Log("space key was pressed");
  14.                 }
  15.                 }
  16.                 else{
  17.                         selectNpc01Message = GameObject.Find("selectMessage");
  18.                         NGUITools.SetActive(selectNpc01Message,false);
  19.                         }
  20.                 }
  21. }

2
NGUI 3 Support / Re: Font Maker corrupts atlas
« on: August 13, 2013, 10:20:25 AM »
Hopefully some is still watching this thread,


Is this the issue you are all getting?
 
After updating the Atlas the font is corrupted. The atlas prefab looks fine in the Inspector (image_01).

 But the font prefab shows the green boarder in the wrong place (image_02). (And I think I can see the corrupted font outline is using graphics from this region.)
 
I can’t find a quick fix. Just tried the one from apocriva. That wasn’t instant but may have helped my: delete from Atlas; reapply with NGUI font maker; shut down Unity – random-cycle till it works, solution.
 
Once working the green-boarder will appear in right place on the font prefab too.

3
NGUI 3 Support / Re: 'BZA' camera tutorial fail.
« 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.

4
NGUI 3 Support / Re: 'BZA' camera tutorial fail.
« 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?

5
NGUI 3 Support / Re: 'BZA' camera tutorial fail.
« 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.

6
NGUI 3 Support / '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.

7
NGUI 3 Support / Re: un-hidden button stuck in hover mode issue.
« on: January 26, 2013, 04:10:28 PM »
Hello just to say thanks for your help.
I ended up with,

GetComponent<UIImageButton>().ResetButton();

and,

   public void ResetButton()
   {
      if (target != null)
      {
         target.spriteName = normalSprite;
      }
   }

Thank you a lot for your help again.

8
NGUI 3 Support / Re: un-hidden button stuck in hover mode issue.
« on: January 24, 2013, 05:16:04 AM »
Hi

Thank you for all this help, but can I ask you to really break this down further for me,

In the script that makes the popup un-hide under “void OnClick(){“ I have placed a line “UICamera.currentTouch.pressed = null;” ...this is not doing anything: do I need to add variable of some sort; am I just not finding the path to the UICamera?

Hope I am not being too lazy  ::)

I am a freelance artist and usually work with Flash plus a little ActionScript. I have just started a job with Unity and nGUI this week (thinking Unity had free ScaleForm). Once this job is done I aim to get my head around nGUI/Unity a little better.

Thank you again for your help.

9
NGUI 3 Support / un-hidden button stuck in hover mode issue.
« on: January 23, 2013, 02:44:20 PM »
Hi,

I am using void OnClick () and NGUITools.SetActive(true/false) to show and hide menu elements.

A button un-hides a game-object holding a series of image-buttons (a popup list of options basically). When one of these buttons is pressed the game-object hides its self again.

After the first use of this popup, the last pressed image-button will show up in its Hover state and not the Normal state.

Other buttons on the pop-up display as expected and the ‘stuck-button’ only deselects Hover after it has been hovered over.

Anyone know how to resolve this? Thankyou.

Pages: [1]