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 - ankit khetrapal

Pages: [1] 2
NGUI 3 Support / Re: Make Links in string clickable
« on: January 27, 2014, 04:25:23 AM »
Hi Wahooney,

Yes what you are suggesting is fine here, i agree with you but my question here is how to implement this.

And for the different colors on the label, its pretty simple to implement, check the link below

NGUI 3 Support / Make Links in string clickable
« on: January 27, 2014, 02:24:14 AM »
Hi NGUI Team,

Is there any way i can make links in a particular string(applied on a UILabel as text) clickable(basically when the user clicks on that area of the label we open that particular link in a new tab).

I can easily strip the links using RegEx and then apply different color codes to them but the issue is my label has multiple lines and i cannot split the normal texts and links in different labels as it would lead to inappropriate collider position triggering the action.

Eg Here is the label

i am using ngui try
this great tool. here is the

Now can i have colliders on the specific areas where there is a link and then trigger the event to open that link in a new tab from there.

NGUI 3 Support / PopUP List and Dynamic Font issue.
« on: December 02, 2013, 07:57:33 AM »
The image attached("ActualLayout") is my default layout.

No when i open the contents of the PopUp list the labels below that are coming above the background of the PopUpList which can be observed in image attached("issue")

How can this be resolved.

NGUI 3 Support / Re: Scroll Bar with Thumb
« on: September 30, 2013, 11:39:34 AM »
I want to use this for uidragablepanel, I don't think there is option to attach uislider to a dragablepanel

NGUI 3 Support / Scroll Bar with Thumb
« on: September 30, 2013, 07:45:04 AM »
How Can one create a scroll bar with thumb using NGUI(something like we use for UI Slider).

Please check the screenshot for what i exactly want

NGUI 3 Support / Re: Missing NGUI scripts when exporting projects
« on: September 20, 2013, 07:48:33 AM »
if i don't select dependencies then the scripts associated with the prefabs will not be exported and i don't want that to happen.

NGUI 3 Support / Re: Missing NGUI scripts when exporting projects
« on: September 18, 2013, 01:06:38 AM »
yes the include dependency option is on when i am exporting the package, but still i am getting missing scripts error in project B.

if i also include NGUI scripts when creating package from project A the everything works fine but i don't want to do that as it will overwrite the custom code i have written on the NGUI files in project B.

NGUI 3 Support / Missing NGUI scripts when exporting projects
« on: September 17, 2013, 01:25:07 PM »
Hi NGUI Team,

I have two different projects compiled with same version of NGUI(2.6.1)now i am thinking of merging those projects so i am exporting all the content from lets say project1, but when exporting the package i am not selecting the NGUI script files as they will already be available in the other project, lets say project 2.

But when doing so i am getting missing scripts exception in the project2 on the content exported from project1.

i did some research and reached to this link:

which says me to enable meta data but even that didn't help.

Other possible solution which could be suggested is to include NGUI script files when exporting content from Project1 and the overwriting those when importing this in project2, i know that is feasible but that won't help my cause as i have made a lot of custom edits to NGUI scripts in the project2 and in future i am also planning to add a lot of projects to the current one.

So what is the exact solution to handle this.

NGUI 3 Support / How to create Nested UIDraggablePanel
« on: July 30, 2013, 02:42:49 AM »
Hi NGUI Team,

How can i create Nested UIDraggablePanel, basically i want to have a draggable panel inside other draggable panel.

I know setting this up isn't hard, the tough part which i am stuck at is to make the elements of nested panel clamp inside the bounds of the head panel.

i will try and explain this more precisely, i want that when i drag the head panel contents, the nested panel elements should also move with them which is happening but i want them to stay visible only within the heap panel clipped area but they are even visible outside it.

Please check attached image for more refference

Hi NGUI Team,

I am planning to implement a Facebook application in which the user can see his wall posts,the snapshot for the Post Prefab is attached, now the problem which i am facing is that i want to add a ShowMore button(as shown in the image) which will appear in case the message for the post(UILabel) is more then lets say 4 lines(which has a fixed Max width of lets say 200 pixels).

Now on pressing the Show more button i want the complete post message to appear, to do that i will have to increase the background sprite of the prefab to certain pixels(depending on total number of lines for a post) plus i will even have to shift down the elements(like comment button , share button and like button)which are placed lower than the message to same number of pixels.But i am not able to understand how can i get the total line count for the UILabel when it is showing the complete messages.if i can have the line count i can easily convert it to pixels and do my stuff.

Now here are the things which i have already tried,

i tried creating a custom method which could help me get total number of lines, here is the code for that

   public static int GetTotalLines(UILabel label)
      Vector2 result = label.font.CalculatePrintedSize(label.text,false,UIFont.SymbolStyle.None);
      int totalLInes = Mathf.RoundToInt((result.x * label.transform.localScale.x)/label.lineWidth);
      return totalLInes;

now the issue with this functionality is that the font.CalculatePrintedSize doesn't calculate pixel space for the white spaces in the message, so if a message has lot of white spaces it will lead to wrong result.

i even tried out the relativeSize property of the UILabel as described in this link

but even this will not work for me as it returns the position with respect to max line count set, not total size(i.e not size in show more mode)

Is there any other way which you guys could guide me through.

Thanks in Advance.

NGUI 3 Support / Re: UI Label line count
« on: July 19, 2013, 08:20:31 AM »
how can i get the total number of lines which will be required to show the label if it is limited with max line count.

i will try and explain this more suppose i have a label which has suppose 40 lines, now to make label look small i set the Max Line var for this label to lets say 5.

So now only 5 lines are visible, now i add a see more button, on clicking which the label should get bigger and show all the lines.

How can this be achieved ?

well i guess writing custom drag-able panel script might have taken a lot of time and i didn't pay NGUI to write custom code so i modified UIDraggablePanel to match my requirement

Just change the RestrictWithinBounds to this add some global declarations at the top

         /// <summary>
   /// Bool to determine whether to inform other object when the user has reached top limit or bottom limit of a dragable panel
   /// </summary>
   [SerializeField]   private bool postLimitEvent;
   /// <summary>
   /// Reciever game object to send Limit notification.
   /// </summary>
   [SerializeField]   private GameObject recieverGameObject;

   /// <summary>
   /// Method to be called when top limit reached
   /// </summary>   
   [SerializeField]   private string topLimitMethodName;
   /// <summary>
   /// Method to be called when bottom limit reached
   /// </summary>
   [SerializeField]   private string bottomLimitMethodName;

   public bool RestrictWithinBounds (bool instant)
      Vector3 constraint = mPanel.CalculateConstrainOffset(bounds.min, bounds.max);
         if(constraint.y > 0)
         if(constraint.y < 0)

      if (constraint.magnitude > 0.001f)
         if (!instant && dragEffect == DragEffect.MomentumAndSpring)
            // Spring back into place
            SpringPanel.Begin(mPanel.gameObject, mTrans.localPosition + constraint, 13f);
            // Jump back into place
            mMomentum =;
            mScroll = 0f;
         return true;
      return false;

Hope other might find it help full.


i have attached a new modified UIInput.cs file which fixes the select on tab bug...

Following modifications are there in the script-

1.) Declared a new private bool variable "isOnTab" - 

private bool isOnTab = false;

2.) Make isOnTab = false at the start of OnSelect() function

3.) Write the following code just after Update() function and before the "if(selected)" code part -

      if (selectOnTab && Input.GetKeyDown(KeyCode.Tab))
            isOnTab = true;

4.) In the code -

        if (selected)
   if (selectOnTab != null && Input.GetKeyDown(KeyCode.Tab))
   UICamera.selectedObject = selectOnTab;

        CHANGE - Input.GetKeyDown to Input.GetKeyUp  and add "&& isOnTab"

       the code changes to

        if (selected)
        if (selectOnTab != null && Input.GetKeyUp(KeyCode.Tab) && isOnTab)
   UICamera.selectedObject = selectOnTab;

The idea here is to select a new gameObject only if the TAB key is released (not pressed) and also to ensure that the Update() function of the next gameObject does not consider TAB key released even if it is not pressed down.

if Draggable panel isn't meant to have dynamically added content, then what other alternative does NGUI provide for dynamic entries.


i am adding data dynamically on a UIDraggablePanel, now suppose i added 10 widgets and now the user is scrolling down and down to see all the widgets, now how can i determine that the user has reached the end so that i can add more data to the list.

Pages: [1] 2