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.

Topics - badawe

Pages: [1] 2
NGUI 3 Support / Culling Mask being changed inside NGUI?
« on: March 23, 2015, 02:45:08 PM »
Hey guys, this is driving me nuts, the hole scenario is, I had a really complex UI, with a lot of elements and about 5 cameras.

One of this is responsible for the Alert Popups, like everything else in this UI I'm using a lot of PoolableObjects, so just to get an Idea of what looks like, is something like that:

In my Alert Camera, I had the Event Mask only marked to the Alert Layer, and in my Camera, the same, this is suppose to only render and interact with the Alert Objects.

And in the initiation of this objects from the pool, I do exactly like NGUITools.AddChild, but I do in my own way, to get the object from the Pool:

  1.  /// <summary>
  2.     /// Display an decision box with 2 choices
  3.     /// </summary>
  4.    /// <param name="title">title of the screen</param>
  5.    /// <param name="content">Target text to be displayed</param>
  6.     /// <param name="button1Label">Label of the button 1</param>
  7.     /// <param name="button2Label">Label of button 2</param>
  8.     /// <param name="button1Callback">Callback for the button 1</param>
  9.     /// <param name="button2Callback">Callback for the button 2</param>
  10.     /// <param name="showOverlay"></param>
  11.     /// <returns></returns>
  12.    public static DecisionAlert ShowDecision(string title, string content, string button1Label, string button2Label, Action button1Callback, Action button2Callback, bool showOverlay = true)
  13.    {
  14.        DecisionAlert alert = ObjectPoolController.Instantiate(Instance.AvaliableAlerts[(int)AlertTypes.Decision].gameObject).GetComponent<DecisionAlert>();
  15.        alert.transform.parent = Instance.ContentTable.transform;
  16.        alert.transform.localScale =;
  17.        alert.transform.localPosition =;
  18.        NGUITools.MarkParentAsChanged(Instance.ContentTable.gameObject);
  20.        alert.Init(title, content, button1Label, button2Label, button1Callback, button2Callback);
  21.        if (showOverlay)
  22.        {
  23.            ShowOverlay();
  24.        }
  26.        Instance.m_activeAlerts.Add(alert);
  28.        return alert;
  29.     }

Now is the strange part, i had a simple button to test this, and keep adding this to the view, and test it out. If i press this button a bunch of times, everything goes perfect, but when I close this Alerts (Pressing the Close button) and try to add a new one, this new one comes from the Pool, and then something strange happen.
My camera lost his Culling Mask, a new UIRoot is created with a new Panel, and from now on, If i remove the new UIRoot, and add one more, the UIRoot is created again.

I do this in mostly every part of the project, but only this one is giving me this problem.

Someone know what can be?

I'm using the 3.8.1 version and Unity: 4.6.3f1

I know this is not a common thing to ask, but I want to be able to let the user search for a string, and keep able to select when he found something, without closing the keyboard, anyone know a solution for something like this?

NGUI 3 Support / Strange issues Unity 4.6.0p1 and NGUI v3.7.6p2
« on: December 05, 2014, 08:47:21 AM »
Hey guys, I'm experiencing this issue right now:

full version here:

Basically I've a few this that are instantiate inside a Scrollview, and looks like are not been update at the right time?! I really can't understand really well what is going on, cause on the Editor View, the bounding box of the object are in the right place, but is not being draw in the right place, when I move this, (dragging) backs to the desired place.

Anyone know what is happening?

Hey just a heads up, I've a lot of buttons inside and ScrollView and everything works fine on editor, but running on the Android, they stay on the Over state when I drag outside the button collider.

To fix that is just add the Android platform in to this statement too, from:

Line: 1128 from UICamera.
  1. if (Application.platform == RuntimePlatform.IPhonePlayer)
  2. {
  3.       useMouse = false;
  4.       useKeyboard = false;
  5.       useController = false;
  6. }

  1. if (Application.platform == RuntimePlatform.IPhonePlayer || Application.platform == RuntimePlatform.Android)
  2. {
  3.       useMouse = false;
  4.       useKeyboard = false;
  5.       useController = false;
  6. }

So the title is pretty self explanatory, but is something like this:"

  1. Game Object (Controller)
  2.       - Content Game Object
  3.             - Scroll View (With Clip)
  4.                   - GRID
  5.                          - Prefabs
  6.                          - Prefabs
  7.                          - Prefabs
  8.                          - Prefabs

So the Content Game Object, start deactivated and offscreen like position x are setted to Screen.width;
When they will become active, I Activate the Content Game Object using NGUITools.SetActive(Content Game Object,true); and them populate the GRID with my prefabs using the exactly same code NGUITools.AddChild() use, but on my own Method, because they are poolable objects. When everything is on Position, I tween the Content Game Object to the position, but all childrens are invisible, but if I do anything with the childrens in Editor, like Move 1 pixel to side, Press MakePixelPerfect anything they show up properly.

Did you guys know if I'm doing something wrong?

Hello guys!

I've just update NGUI to the lastest (3.7.0) version, and in one test I've noticed something, and I want to know if this is right:

My Hierarchy is something like this:
This is all under the UI Layer.
 - UI Panel
    - UI Panel /  Scrollview
        - UI Grid
             - 2D Sprite Element
             - 2D Sprite Element
             - 2D Sprite Element
             - 2D Sprite Element

But I can't drag this the itens, because the camera never reach this, without put a rigid body on each one.
This does not sound right.

My camera setings are: 3D Worls, All event masks. Culling Mask only UI.

NGUI 3 Support / Moving Scrollview generate a bug with fonts [Solved]
« on: July 18, 2014, 09:18:51 AM »
So, I'm facing a bug right now that simple don't make any sense to me.

Here is the Hierarchy:

And I dynamically move 2 objects, the Content under Sidebar and the Menu game objects.
Just tweening to appear on screen and move back to the hiding place.

When the animation to open occurs the font stays offposition:

But in the scene view, you can see the bounding box of the object is in the right place:

But if I move the object by dragging this in the scene view, everything works perfect:

NGUI 3 Support / Only enable the move handle
« on: May 23, 2014, 07:53:47 AM »
There is some way of achieving that? I don't use the rotate and the stretch as much as moving around, maybe if to do this others 2 with some key binding as a option was nice.

Congratulations! This new version looks amazing! And the integration with the native sprite is a awesome news!

Right now, I'm trying to use a UI2DSprite animated using AnimationController and Native animation, but not looks like possible, I write a mirror class to set the UI2DSprite the same value as Sprite Renderer too, but don't work ether, do you have any idea if that wold be accomplished?

NGUI 3 Support / Localization with dynamic numbers
« on: December 05, 2013, 11:19:04 AM »
Hey guys, just to help anyone out there with the same thing;

We have some things in our game, like a button to with the label "Hire for $10" but this needs to be localized, and I started using replace, but now we've come with a better way, just add this new method to Localization.cs

  1.     static public string Localize(string key, params object[] pValue)
  2.     {
  3.         string tString = Localize(key);
  4.         tString = string.Format(tString, pValue);
  5.         return tString;
  6.     }

And in our language.txt use like that:
  1. hire_btn = Hire for {0}

and in your code you can just pass, many parameters as you want, like these:
  1. hireLabel.text = Localization.Localize("hire_btn", tLevelPrice);

Help us here! I hope can help any other! Maybe Aren can put this by default on the Localization.

NGUI 3 Support / NGUI 3.0.6 f7 cant set the size of sprite.
« on: December 03, 2013, 10:36:34 AM »
I have a 3D camera, and I use that to render some 2D sprites with Panel.
Everything works in the 3.0 version, but now i update to ngui 3.0.6f7 and i can't set the size of game object again.
The sprite have the size of 20x20 but i want to use in gameplay with the size 1x1;

But in this last version, i cant set to 1x1! Every time i change automatically come back to 2x2! What is going on? I'm missing something?

hello :)

Just a doubt that catch me right now. What is the Right way of do a Draggable Panel anchored TOP in NGUI? LIke any games display of any social game, like these:

the left one.

What we do here, is something like these:

Let's say the resolution of the app is 640x960 (iPhone 5)

The hierarchy is like this:

So we have:
[-10][3,0] Home UIPanel
    UIPanel (Clipped View) UIPanel + UIDraggable Panel 
         UIGrid UIGrid

And the UIPanel (Clipped View)   have this configurations:

But this don't really work, anyone have any other way of doing that?

TNet 3 Support / Problems starting the Example Menu in one network.
« on: April 26, 2013, 09:02:24 AM »
Hey Arena, great job on TNET, i never worked with networking before, but it's really simple and intuitive.

So, yesterday i bought the TNET on my home, and start play around with it, and everythings works fine, I have a PC in home.

But today, I'm trying to get this working on my company, but i can't get working, here we have Macs, i don't know if is something related, but i keeping getting this message:
  1. Object reference not set to an instance of an object
  1. Operation timed out

Here is the screen.

Its just the example scene!
I don't know if is something related to my network here, or something in our mac, but is the exactly same thing i tested in home yesterday.
Can you help me? What is wrong?

Another thing, if you please can share these final projet:

will be really usefull.

NGUI 3 Support / 2 CustomEditor for Transform?
« on: March 21, 2013, 02:00:21 PM »
Hi there!

This questions is not about the NGUI itself, but about the NGUI Transform window!
As you guys know, the NGUI have a custom inspector for transform, and it's amazing!

And we make one plugin that extends transform too, but the problem is, the NGUI aways override our function, we don't know exactly what we can do to make this things work together??

Do you guys have a clue?

Hey guys!

Here at Monster Juice, we love NGUI and use it everywhere, we even have done a entire game in NGUI:

But now, we are starting another project, and is 2D Platform game in Unity, and we are really liking the idea of making another game entirely in NGUI.

But the first problem is, what we should do about the Physics?

Look at this simple example:
Using default unity camera

And here is the same scene
using NGUI Camera

I made another test, using the NGUI Panel, but with a regular camera with ortographic size of 384 but everything get really slow because the size of things.

I can't figure out, what is the best way. Do you guys have one idea? Or I should give up NGUI for make the entirely game.

Pages: [1] 2