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

Pages: [1] 2
NGUI 3 Support / Re: NGUI Scrollview and Depth Issue
« on: June 13, 2017, 02:12:51 AM »

Thanks! i never thought about that.

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 / Re: SpringPanel Begin doesnt work in Start()
« on: June 02, 2017, 02:27:33 AM »
It doesnt matter now, i figured it out, i just ran it once in Update() and then used 'CenterOn' to get my page to load.

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 / Re: GUI Grid with pages
« on: May 10, 2017, 01:43:16 PM »

ok ive managed to do it now, the widgets made sense and i just had to mess about with offsetting the anchors, works like a charm.

Thanks Dude!


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 / Re: UILabel.text garbage from string array
« on: April 04, 2017, 06:30:02 AM »
Ok yes im more of an artist but just creating NGUI action for this and others in the playmaker community for NGUI if it works for me as this would be really useful. Love NGUI myself over all the other assets ive used as an artist in Unity. I have done loads of making C# scripts into playmaker actions but i knew its more of a dev job, but i tried to tackle this as a one off task as i need this for my own project.

i tried what you said about the wrapping to be 'resize freely' and i cant seem to see the uncheck box 'to not use symbols' using the encoding checkbox. (screenshot attached). I tried it again with this but still get garbage, must be as i cant find the symbol checkbox.

Ok well if there is going to be in the next version of NGUI then that's great! appreciate it. So does that mean in the next version, do i have to use 'resize freely' or can i use any other 'overflow' setting.


NGUI 3 Support / Re: UILabel.text garbage from string array
« on: April 04, 2017, 04:39:59 AM »

I'm not sure exactly what to do, im not suing the same code as the link in the post. But i am making a Playmaker action from a script i found online (which ive pasted below). Is this still possible with this approach? sorry i'm still learning and not sure how to apply what you said to this following code. My fault as i forgot to paste this in my first post. You can see that if you use NGUI its there's garbage, if i use UGUI and comment out NGUI then i get no garbage.

  1. using UnityEngine;
  2. using UnityEngine.UI;
  4. public class garbagefreetext : MonoBehaviour {
  6.         UILabel _NguiLabel; //NGUI
  7.         //Text _UguiLabel; //uGUI
  9.         string[] generated;
  11.         void Start () {
  13.                 _NguiLabel = GetComponent<UILabel>(); //NGUI
  14.                 //_UguiLabel = GetComponent<Text>(); //uGUI
  16.                 generated = new string[100];
  18.                 // go from 0 to 99.
  19.                 for (int i = 0; i < 100; i++) {
  20.                         generated [i] = string.Format ("{0:00}", i);
  21.                 }
  22.         }
  24.         void Update () {
  25.                 int random = UnityEngine.Random.Range (0, generated.Length);
  26.                 _NguiLabel.text = generated [random]; //NGUI
  27.                 //_UguiLabel.text = generated [random]; //uGUI
  28.         }
  30. }

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 / Re: Get Sprite Atlas Index Number
« on: March 26, 2017, 11:52:33 AM »

Ok what i mean by index is when you create a atlas, i want to choose one of the items inside this by referencing a number value? e.g. 1=image 1..... 2= image 2
So if you are saying i can use the name sprite.spriteName = "abc" then i can just use numbers as the name then. Thanks.

Thanks and ill take a look at UISpriteAnimation.


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 / Re: NGUI 40B Garbage per frame
« on: March 19, 2017, 06:42:51 AM »

no i havent got the latest version, im a few versions back, ill try updating to the latest version then, as im new to profiling i haven't managed read the whole documentation of NGUI yet so i wasnt sure what should/shouldn't be showing in the profiler.



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 / Re: UI Panel Late Update Garbage Spike
« on: February 24, 2017, 08:36:28 AM »
ok thanks for this, i was just checking if all was ok and i can understand that it needs to do this.

Pages: [1] 2