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

Pages: [1]
1
NGUI 3 Support / Re: Best use of Atlases?
« on: October 15, 2014, 10:38:35 AM »
No need to make an atlas if it is the only image taking it up. You wouldn't be reducing any draw calls. Use UITexture instead and load them in from resources folder. For whatever UI you have, you can build an atlas out of that.

2
I have a question on performance and best practices. I have an atlas that I am needing to add a few more pngs to and it will bump it from 1024x512 to 1024x1024. This will cause a lot of empty space on the atlas. Would there be a substantial enough performance gain by placing those pngs on a separate atlas? This would create a 1024x512 and a 512x256 atlas'. For mobile devices.

Thanks

3
NGUI 3 Support / Re: Update 2.5.0c - New Placement Handles
« on: March 28, 2013, 08:46:21 AM »
Terribly difficult to use, had to roll back, please change these back!

4
NGUI 3 Support / Scale panel and contents based on width.
« on: March 20, 2013, 01:20:34 PM »
I have my UI working just fine with the use of anchors. The problem I am having is I have one specific panel that I need the contents to be scaled based on the width of the screen. I need the contents to stretch to fill the screen whether the ratio is 3:4 or 9:16. Currently if I have the panel scaled to fill the screen width wise on the iPhone 5 screen then when I scale it to the the LG Optimus L3 screen (3:4) then the panel contents are no longer filling the width and on such a small screen it is harder to see and they have the room to scale up and fill the screen.

Any hints?


5
Alright got it to work:

  1. using UnityEngine;
  2.  
  3. [RequireComponent(typeof(UISlider))]
  4. public class LevelPercentage : MonoBehaviour
  5. {
  6.     UISlider mSlider;
  7.         UILabel mLabel;
  8.  
  9.     void Awake ()
  10.     {
  11.         mSlider = GetComponent<UISlider>();
  12.         mSlider.eventReceiver = gameObject;
  13.                 mLabel = GetComponent<UILabel>();
  14.  
  15.     }
  16.  
  17.     void OnSliderChange (float val)
  18.     {
  19.                 val = val * 100;
  20.         mLabel.text = val.ToString ("0.\\%");
  21.     }
  22. }
  23.  
  24.  
  25.  

If doing something wrong in that let me know, but it did work when attached to the label. Removed my original UISlider component and let it make its own.

6
So I've kind of got it to work using this:

  1. using UnityEngine;
  2.  
  3. [RequireComponent(typeof(UISlider))]
  4. public class LevelPercentage : MonoBehaviour
  5. {
  6.     UISlider mSlider;
  7.         UILabel mLabel;
  8.  
  9.     void Awake ()
  10.     {
  11.         mSlider = GetComponent<UISlider>();
  12.         mSlider.eventReceiver = gameObject;
  13.                 mLabel = GetComponent<UILabel>();
  14.  
  15.     }
  16.  
  17.     void OnSliderChange (float val)
  18.     {
  19.         mLabel.text = val.ToString ();
  20.     }
  21. }
  22.  
  23.  
  24.  


However, I don't know how to get it to point to the existing UISlider on my Progress Widget. As it is not, when attached to the UILabel it creates the UISlider because I have it set to require component. However, I want to ditch the require component and set it to point towards the existing UISlider. I have tried this:

  1. using UnityEngine;
  2.  
  3. public class LevelPercentage : MonoBehaviour
  4. {
  5.     [SerializeField] UISlider mSlider = null;
  6.         UILabel mLabel;
  7.  
  8.     void Awake ()
  9.     {
  10.         mSlider = GetComponent<UISlider>();
  11.         mSlider.eventReceiver = gameObject;
  12.                 mLabel = GetComponent<UILabel>();
  13.  
  14.     }
  15.  
  16.     void OnSliderChange (float val)
  17.     {
  18.         mLabel.text = val.ToString ();
  19.     }
  20. }
  21.  
  22.  
  23.  

I thought this would point towards the OnSlider FunctionName in the UISlider but it isn't. I am sure there is something simple I am missing here but I just can't see it. Any help?

7
I have a progression widget setup that I would like to have send it's value to a UILabel to input into the Text field. I have research the UIEvenReceiver and Listener but still have not figured out exactly how all that works. Can I get little more of example here?


To add on here is what I have so far:

  1. using UnityEngine;
  2.  
  3. [RequireComponent(typeof(UISlider))]
  4. public class LevelPercentage : MonoBehaviour
  5. {
  6.     UISlider mSlider;
  7.         UILabel mLabel;
  8.  
  9.     void Awake ()
  10.     {
  11.         mSlider = GetComponent<UISlider>();
  12.         mSlider.sliderValue = mLabel;
  13.         mSlider.eventReceiver = gameObject;
  14.     }
  15.  
  16.     void OnSliderChange (float val)
  17.     {
  18.         mLabel = val;
  19.     }
  20. }
  21.  


Now I know that I am getting an error converting. I am not sure if I am going in the right direction or not.

Pages: [1]