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 - storm33229

Pages: [1] 2 3
1
NGUI 3 Support / How do I enable appropriate word wrapping for Arabic?
« on: September 30, 2014, 12:41:47 PM »
I am using a UILabel with an i2 localization component. The Arabic is displaying right-to-left (correct) but when it is word-wrapped the label puts the first (right-most) word on the bottom. This is incorrect; Arabic reads top-to-bottom& right-to-left. How can I make word-wrap work correctly for right-to-left languages?

2
NGUI 3 Support / Re: How do I completely disable all user input?
« on: September 27, 2014, 11:12:27 AM »
Generally, I put a UIWidget with a collider on top that stretches to the entire screen with the built in anchors, an just have it do nothing when touched.

Wow that's brilliantly simple, and works perfectly! Thank you. I can't believe I didn't try this to start   :-[

3
NGUI 3 Support / How do I completely disable all user input?
« on: September 26, 2014, 11:48:09 PM »
When I click a button to initiate a transition from one UI screen to the next, I want the user input to be completely disabled until the transition has completed. How do I completely disable all user input?

4
UICamera.debug is stateful and does not reflect 'First Camera' options. This is fine, except that the ability to modify it is hidden if it is not the first camera. To solve this problem I did:

UICamera line ~876
  1. if (debug && handlesEvents) NGUIDebug.debugRaycast = true;
  2.  

5
NGUI 3 Support / Re: How do I re-parent in NGUI?
« on: September 29, 2013, 11:24:20 PM »
gameObject.transform.parent  = new parent object.transform

Is this what you were looking for?  This changed the current object's parent to a new one.

Well, I use this one all the time... but I was curious if NGUI had a specific function for wrapping any special behavior it may want to do in addition to the re-parent.

6
NGUI 3 Support / How do I re-parent in NGUI?
« on: September 29, 2013, 07:27:49 PM »
Now that I know NGUITools.AddChild adds a gameobject properly, I am curious how to migrate to a different parent.

7
NGUI 3 Support / Re: Going insane working with clip panels and grids...
« on: September 29, 2013, 07:20:18 PM »
Ok first of all, use NGUITools.AddChild instead of Instantiate. It parents the object, sets its layer, and resets its pos/rot/scale for you all in one go.

Second, use yield return new WaitUntilEndOfFrame(); or whatever that command is called so that you don't skip a frame.

Lastly... use NGUITools.Destroy instead of just Destroy. It unparents the object for you. If you don't do this, Unity doesn't actually remove the object from the hierarchy until the end of frame -- which is why reposition call doesn't work for you.

Wow this information is really helpful! I had been wondering if I was missing something as far as adding/removing widgets was concerned...apparently I was  ;D

Thanks for your help, this totally fixed the issue.

8
NGUI 3 Support / Going insane working with clip panels and grids...
« on: September 29, 2013, 02:15:17 PM »
I have one clip panel and underneath it a grid. I dynamically add buttons to it, and remove buttons from it (when they are clicked). The desired behavior is that the grid reorganizes itself after each add/remove so that there are not giant gaps between buttons.

So I have:

  1.    
  2.     private IEnumerator CoUpdateDragPanelAndGrid()
  3.     {
  4.         //update the grid
  5.         m_unitListGrid.Reposition();
  6.  
  7.         //put a frame between updating the drag panel and the grid
  8.         yield return null;
  9.  
  10.         //update the drag panel
  11.         if (m_dragPanel != null)
  12.         {
  13.             m_dragPanel.RestrictWithinBounds(false);
  14.             m_dragPanel.ResetPosition();
  15.         }
  16.     }

This is called after add/remove of a button:

Add:
  1.         GameObject unitButtonObj = Instantiate(unitButtonPrefab) as GameObject;
  2.  
  3.         unitButtonObj.transform.parent = m_unitListGrid.transform;
  4.  
  5.         unitButtonObj.transform.localScale = Vector3.one;
  6.  
  7.         EditTeamUnitButton button = null;
  8.  
  9.         unitButtonObj.VerifyComponentRecursively(ref button);
  10.  
  11.         //setup the button to act as a drag content for the draggable panel
  12.         UIDragPanelContents dragContents = null;
  13.  
  14.         if (unitButtonObj.VerifyComponentRecursively(ref dragContents))
  15.         {
  16.             dragContents.draggablePanel = m_dragPanel;
  17.         }
  18.  

Remove:

  1.             Destroy(button.gameObject);
  2.  
  3.             StartCoroutine(CoUpdateDragPanelAndGrid());
  4.  

I've attached some images that show what I am seeing... Interestingly, if I reverse the update code to be:

  1.     private IEnumerator CoUpdateDragPanelAndGrid()
  2.     {
  3.         //update the drag panel
  4.         if (m_dragPanel != null)
  5.         {
  6.             m_dragPanel.RestrictWithinBounds(false);
  7.             m_dragPanel.ResetPosition();
  8.         }
  9.  
  10.         //put a frame between updating the drag panel and the grid
  11.         yield return null;
  12.  
  13.         //update the grid
  14.         m_unitListGrid.Reposition();
  15.     }
  16.  

If I do this, the removal works, but on  trying to Add back it jumps the clip panel center to one side...and cuts off my buttons. The workaround I am using right now is using the first method for adding, and the second method for removing.. I really want to know what I am doing wrong in the first place though..

9
NGUI 3 Support / Re: How do I set margins for a clip panel?
« on: July 10, 2013, 01:34:17 PM »
Yeah.

Got it. I did what you said, and looked more closely at how you have your scroll/clip example setup, and now mine works :D

10
NGUI 3 Support / Re: When do I use FixedSize vs PixelPerfect?
« on: July 10, 2013, 01:33:37 PM »
Again... use FixedSize + aspect ratio setting in the game window to test how UI will look at your target resolution.

When it's time to publish, change it to PixelPerfect, and hit the Build button.

Do not change anything at run-time.

Ah, I understand. FixedSize is for my testing only - so that it fits in my smaller Unity Game Window. PixelPerfect will still apply in the final build. Perfect. Thanks for the help -- I apologize that it took me so long to grasp how this works.

11
NGUI 3 Support / Re: When do I use FixedSize vs PixelPerfect?
« on: July 09, 2013, 10:54:26 PM »
To whatever resolution you are trying to test.

The best thing to do would be to have a dual monitor setup and detach your game window so that it floats on the 2nd monitor. Failing that though, the fixed size is the approach to take.

I think I'm starting to understand better. Unfortunately I don't have a second monitor (using laptop). So I should keep the scaling style to FixedSize, and then set the Manual Height value to the resolution of the game window (at run-time)? Based on what I think you're saying this will make it pixel perfect at the manual height...

12
NGUI 3 Support / Re: How do I set margins for a clip panel?
« on: July 09, 2013, 10:52:00 PM »
Clipped area = purple rectangle. It is not in any way related to any actual outline of the window, or the window's background, which is done using different sprites. Therefore you can create visible padding by simply adjusting that purple rectangle (by adjusting the clipped rect on the panel).

How do you change the clipped area? The bright purple outline changes when I change the clip center/size. Is this the correct way to change the clipped area?

13
NGUI 3 Support / Re: How do I set margins for a clip panel?
« on: July 09, 2013, 09:40:45 AM »
I'm also looking into your Example 7 - Scroll View (Panel), because this is effectively what I am looking for in a UI. The key difference is that it isn't a full screen UI with clip panel having margins relative to the screen.

14
NGUI 3 Support / Re: When do I use FixedSize vs PixelPerfect?
« on: July 09, 2013, 09:21:41 AM »
Your question was how to change the "resolution" of the UI, and manual size is how it's done. It doesn't mean you have to keep it at "manual" after you test the behaviour.

So I should dynamically set the manual value to whatever my screen resolution is?

15
NGUI 3 Support / Re: How do I set margins for a clip panel?
« on: July 09, 2013, 09:04:19 AM »
Clipped panels don't have margins. If you want there to be some spacing between the edge of your clipped panel and your window, then shrink the clipped area.

When you say "clipped area", are you talking about the contents of the clipped panel? So if I had a bunch of buttons in the panel, I would shrink each one? How could I do this non-uniformly?

edit:

I am trying to create a UI like the inventory in "TES IV : Oblivion" (see).

In that UI there is a scroll view, that has some margins between the edges of the presented UI.

Pages: [1] 2 3