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

Pages: [1]
NGUI 3 Support / NGUI Scrollview and Depth Issue
« on: June 12, 2017, 03:23:35 AM »

I have setup the following for menu, which uses buttons for navigating pages, i cant place them inside the scrollview as i need them to visible on all pages. I have a weird issue where if i change the UIScrollview depth to 1. The left and right buttons are no longer clickable. If i change this back to 0, then i can click them. Any ideas why?

UIRoot (depth = 0)
    - Button Right (depth = 2)
    - Button Left (depth = 2)
    - UIScrollView (With UI Panel of Depth = 1)
         - Grid

NGUI 3 Support / SpringPanel Begin doesnt work in Start()
« on: May 30, 2017, 09:46:21 AM »

I have written this code for my level select screen for my game, i basically have several grids and parents which i use as "pages" which are simply just offset from each other. Currently i use this for OnClick() and it successfully scrolls to the page offset.

Now i want to run this function once on first launch, so basically it will take the player back to the last page they were on, I have tried calling this in Start() but it doesnt scroll to the page? i guess that the 'SpringPanel.Begin' doesnt work on Start() or OnEnable()? i thought it would as ive seen others using it in those. What can i do? or am i just missing something.

  1. void goToPage(int PageNumber)
  2.     {
  3.                 int page = PageNumber;
  4.                 int max = totalPages;
  6.                 UICenterOnChild center = levelSelector.GetComponent<UICenterOnChild>();
  7.                 UIPanel panel = levelSelector.GetComponent<UIPanel>();
  9.                         UIScrollView sv = panel.GetComponent<UIScrollView>();
  11.                         var child = levelSelector.transform.GetChild(page); //pass in page number
  12.                         Debug.Log(child, child.gameObject);
  14.                         Vector3 offset = -panel.cachedTransform.InverseTransformPoint(child.transform.position);
  15.                         if (!sv.canMoveHorizontally) offset.x = panel.cachedTransform.localPosition.x;
  16.                         if (!sv.canMoveVertically) offset.y = panel.cachedTransform.localPosition.y;
  18.                         //Debug.Log("Xpos: " + offset, child.gameObject);
  19.                         SpringPanel.Begin(panel.gameObject, offset, 6f);
  21.     }

NGUI 3 Support / GUI Grid with pages
« on: May 08, 2017, 09:16:34 AM »

Im trying to build a level select menu in NGUI and i just wanted to ask what is the best way to approach building the following example?

I have looked into using Grid with a Scroll Panel but i need to somehow create anchors and pages too. Not sure what i can use to offset the grid so i can get this to work. I dont need help with making the GUI stuff, just wanted to see if i can achieve the demo above in NGUI or if it is not possible.


NGUI 3 Support / UILabel.text garbage from string array
« on: March 30, 2017, 09:26:12 AM »

I am setting UILabel.text using 'GetComponent<UILabel>();' and I am updating the text from a string array.
when i update this i get garbage being generated, is this just a unity profiler issue and wont appear during a build?

I ask this as i have done a test using the same code but with UGUI instead and i get no garbage when updating the ui text.

All i can find is this post but i can see that setting a text value for a UILabel allocates memory. Is this still the case?


NGUI 3 Support / Popups - Activate/Deactivate vs Margin off screen
« on: March 27, 2017, 03:57:17 AM »

I have several popups within my ui root and at the moment i am using activate to show/hide the popups. I was wondering is it a bad idea to do this each time? as will it create additional garbage every time its called. Or do i not hide them and simply margin them off the screen. I just wanted to know which option is best on performance overall?


NGUI 3 Support / Get Sprite Atlas Index Number
« on: March 24, 2017, 10:28:35 AM »

I heard a while ago that NGUI supported sprite animation, dont know if its still the case but i wanted to ask if its possible to target a specific sprite image inside an atlas? so i can generate one random image from a sprite sheet.


NGUI 3 Support / NGUI 40B Garbage per frame
« on: March 12, 2017, 12:49:44 PM »

I have one NGUI UI Sprite which is taking 40B of garbage every frame (attached screenshot)

I have 3 other buttons which have exactly the same setup and use the same atlas to choose the sprite from, the other UI sprites never create any garbage. Any ideas why this one is generating garbage?


NGUI 3 Support / UI Panel Late Update Garbage Spike
« on: February 23, 2017, 08:31:12 AM »

Attached is the profiler screenshot of UI panel update for the first frame of my scene. Is this normal? or should it 0 garbage?


NGUI 3 Support / NGUI Countdown Clock Transform 360
« on: January 31, 2017, 06:27:34 PM »

I wanted to ask if its possible to make a clock with a rotating hand in NGUI?

I am experimenting and i have a old asset which achieves this but i would rather solely use NGUI and not another asset. Also as the asset is old and use the legacy gui it create alot of garbage being generated from he transform3d.

The attached image shows a clock back with an arrow as the hand, it rotates from 0 to 360 and when it finishes calls an event finished. The duration of the rotation is based on a value specified in the 'value max' and this is the total number of seconds it will take. I use this for the total time per level.

I hope anyone can help or help me understand where i can start to recreate this in NGUI

this is how the other asset works (



NGUI 3 Support / NGUI to playmaker events and garbage spike
« on: January 29, 2017, 01:21:32 PM »

Im using NGUI events to playmaker script and everytime i test a touch event on my device (unity remote 5) i get this spike. why is this?

Attached the screenshot, all i'm using is a sprite texture and have my camera setup with touch only enabled.

What am i doing wrong?


NGUI 3 Support / NGUI to place a popup in the same UI root or not?
« on: January 16, 2017, 03:24:57 AM »

I have setup my game and added some screen controls (jump etc) then i have one button which will activate a popup. I have no problem with this process. At the moment i have the popup menu alongside my screen control buttons, just with a higher widget depth. Is this the best practice for popups? in terms of where i have it now or is it best practice to have popups in there own separate UI Root?


NGUI 3 Support / NGUI Touch Event Issue
« on: November 10, 2014, 04:00:07 PM »
Hi, i have NGUI setup fine and have setup a button to work using OnPressEventDown and have one OnPressEventUp. These work fine, however, ive noticed when i hold the button down and move my finger away from the button (anywhere on the screen) whilst not lifting my finger, it doesnt realise that im not over the button anymore? how can i detect this?

totally lost

Pages: [1]