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

Pages: 1 2 [3] 4 5 6
31
NGUI 3 Support / How can i anchor a UIPanel ?
« on: November 19, 2014, 06:29:33 AM »
I'm using NGUI 3.7.1 ( And not allowed to update at the moment ).
When i want to anchor some object i add an Anchor to it's sprite, label etc... and if there is nothing there i'm adding a widget. The problem is, UIPanel's anchor doesn't have the same behavior like the normal anchors. So the question is, is it ok to put an extra UIWidget to apply the anchor on it? will it mess things up as far as the alpha and other properties goes ?

32
NGUI 3 Support / Re: Delegate onKey doe's not work.
« on: August 17, 2014, 07:47:52 AM »
Ok i'v used this and it works  :) :

EventDelegate.Set(laterInputField.onChange, LaterInputField);

33
NGUI 3 Support / Delegate onKey doe's not work.
« on: August 17, 2014, 06:17:08 AM »
  1. void Awake()
  2.         {
  3.                 UIEventListener.Get(laterInputField.gameObject).onKey += laterInputField_Typed;
  4.         }
  5.  
  6. void laterInputField_Typed(GameObject go,KeyCode key)
  7.         {
  8.                 print ("laterInputField_Typed");
  9.         }
  10.  

This example won't print anything, and i'v checked, the other delegates are working fine .
I'm working from version 3.5.3 and i can't upgrade at the moment, so maybe a piece of missing code or something that can fix it will be very appreciated. Thanks.

34
NGUI 3 Support / Re: Some performance questions.
« on: August 04, 2014, 11:45:23 AM »
This is a team project and they won't upgrade the version for some reasons...
But this one isn't that old, is it an known issue for this version ? have you tried it yourself with the newest NGUI ?

35
NGUI 3 Support / Re: Some performance questions.
« on: August 04, 2014, 10:23:39 AM »
1 to 3 *seconds*? What? With how many widgets? What version of NGUI are you running? Are you doing a deep profile or something?

No deep profiling, It happens that way even if the profiler isn't on.
It is about 1sec-2sec. ( And i'm Activating and Deactivating only the parent sprite of them all ).
1.5k Tris, so i guess each sprite uses two ( to make a quad ), so that will be 750 sprites 72x72 res each.
NGUI 3.5.3
Unity 4.3.4
Picture of the scene with "Stats" on :


My hardware :
Intel Q6600, 8gb ram, geforce GTX480 ( Works good with Unreal Engine 4 so this is not an hardware problem ).

Edit : I'v also disabled the colliders last time and i didn't mention it, it toke a big hit on performance for some reason, after disabling only the UIRect it went from 0.25ms~ to 0.05ms~

SetActive however, can't be filtered, so it will have to disable everything and always be slowest.


36
NGUI 3 Support / Re: Some performance questions.
« on: August 03, 2014, 08:54:32 PM »
Also, this is the times i'v got with this script :

  1. bool toggle = false;
  2.         bool toggle2 = false;
  3.  
  4.         public GameObject parent_;
  5.  
  6.         void Update()
  7.         {
  8.                 if(Input.GetKeyDown(KeyCode.A))
  9.                         StartCoroutine(ToggleSetActive());
  10.  
  11.                 if(Input.GetKeyDown(KeyCode.S))
  12.                         StartCoroutine(EnableDisableComponents_());
  13.         }
  14.  
  15.         IEnumerator ToggleSetActive()
  16.         {
  17.                 float delta_ = Time.time;
  18.                 parent_.SetActive(toggle);
  19.                 yield return null;
  20.                 delta_ = Mathf.Abs(delta_ - Time.time);
  21.                 print ("SetActive delta_ : "+delta_);
  22.                 toggle = !toggle;
  23.         }
  24.        
  25.         IEnumerator EnableDisableComponents_()
  26.         {
  27.                 float delta_ = Time.time;
  28.                 DisableComponents.EnableDisableComponents(this.gameObject,toggle2);
  29.                 yield return null;
  30.                 delta_ = Mathf.Abs(delta_ - Time.time);
  31.                 print ("Enable Component delta_ : "+delta_);
  32.                 toggle2 = !toggle2;
  33.         }

It makes the action and then one frame and tells the time differents between that frame ( And no, Time.deltaTime won't work properly for this one, you can try ) :

Results :
SetActive delta_ : 0.333334
Enable Component delta_ : 0.263649
(Tested several times each)

in reality, I'm still waiting about 1sec-2sec for the game to start running again with "SetActive" while in "Enable Component" I wait about 0.3sec.

37
NGUI 3 Support / Re: Some performance questions.
« on: August 03, 2014, 02:17:26 PM »
I'v Added the script i was using to disable and enable the UIRect components :

  1. public static UIRect[] uIRectArray ;
  2.  
  3.         public static void EnableDisableComponents(GameObject gameObject_,bool enable_)
  4.         {
  5.  
  6.                 uIRectArray = gameObject_.GetComponentsInChildren<UIRect>();
  7.  
  8.                 foreach(UIRect uIRect_ in uIRectArray)
  9.                         uIRect_.enabled = enable_;
  10.  
  11.                 Array.Clear(uIRectArray,0,uIRectArray.Length);
  12.                 }

38
NGUI 3 Support / Re: Some performance questions.
« on: August 03, 2014, 02:07:28 PM »
I'v just checked it with the profiler !

When using SetActive on the the parent object, "it says" it takes 8-9ms. ( CPU Graph ).
And when using the function i'v posted, it says about 8-9ms as well.
HOWEVER ! And i'v checked it and rechecked it several times !
When i'm activating the SetActive in runtime, the game freezes and i can count about 1sec to 2sec till the editor snap out of it, and the same happened everytime i'v tried it.
And when i'v used my function to enable the components ( all of them in the whole big hierarchy ), it toke it about 0.3sec to snap out of it, and i'v tried it several times .

SetActive() - 1sec to 2sec.
script.enable - 0.3sec.

So, what's up with the profiler? getting so overwhelmed by the SetActive() function that he is losing his count ? lol

39
NGUI 3 Support / Re: Some performance questions.
« on: August 03, 2014, 11:29:49 AM »
Thanks.
Yeah an array will be better, i'v tried many thing so i just left it like that...
The collider is not the issue, i'v just added it just in case.
The real issue is how to free memory and cpu by disabling all those textures/sprites, set alpha to 0 wont do that, i'v checked it already.

I'v tested a scene with 2900 UISprites, each sprites was 72x72 in res.
when :
    *they all was on screen i got 150fps~
    *they all went to Vector3(100000,0,0) 150fps~ ( Off screen ).
    *the first parent one has it's alpha set to 0, 150fps~ maybe a little more...
    *all had their sprites set to disable via the script mentioned above : 3200fps~
    *Only the first parent gameObject has been disabled ( SeyActive(false) ) : 3800fps~

Also, this way i wont lose functionality which is not UIRect or collider related on hidden objects.
I guess i will just have to use the profiler to check what cost's more at the moment i use it, maybe i should do it while in loading screen or something...

40
NGUI 3 Support / Re: Some performance questions.
« on: August 03, 2014, 10:02:04 AM »
I have an other question  :)

I know gameObject.SetActive() function is very expensive, and i'm aiming my games to mobile devices.
And,I know i have to free the  memory somehow.

However, in objects with big hierarchies, In order to disable all components i have to do something like this :

  1. public static List<UIRect> uIRectList = new List<UIRect>();
  2.  
  3.         public static List<Collider> colliderList = new List<Collider>();
  4.  
  5.         public static void EnableDisableComponents(GameObject gameObject_,bool enable_, bool goToRemote = false)
  6.         {
  7.  
  8.                 uIRectList = gameObject_.GetComponentsInChildren<UIRect>().ToList();
  9.                 colliderList = gameObject_.GetComponentsInChildren<Collider>().ToList();
  10.  
  11.                 foreach(UIRect uIRect_ in uIRectList)
  12.                         uIRect_.enabled = enable_;
  13.                
  14.                 foreach(Collider collider_ in colliderList)
  15.                         collider_.enabled = enable_;
  16.  
  17.                 uIRectList.Clear();
  18.                 colliderList.Clear();
  19.  

And i know GetComponent is kind of expensive too, so what should i go for in order to get the best performance for mobiles ? Thanks in advance !

41
NGUI 3 Support / Re: Some performance questions.
« on: August 01, 2014, 08:53:47 PM »
Thanks a lot ArenMook !  :D

42
NGUI 3 Support / Some performance questions.
« on: July 31, 2014, 01:24:52 PM »
1. Is using a lot of panels inside panels bad for performance ? is each panel take at least one draw call ?

2. Is moving objects to remote position ( Vector3(10000,0,0) for example ) will make them not being processed duo to the fact that they are not on the camera boundaries?
Or do i have to disable their components ?

3.Widgets that are hidden by other widget and the user can't see them, processed as well ?

4.Is lowering the alpha value to 0 is equal to disable the component ?

5. Is moving objects with UITween subclasses is more expensive then using Transform.localPosition = someVector3 ?
I'm talking about a situation that the duration time is zero and the object just need to snap to somewhere else.

If i will think of more questions i will add them later, Thanks in advance !


43
Add this function to it:
  1.         /// <summary>
  2.         /// Clear the logged text.
  3.         /// </summary>
  4.  
  5.         static public void Clear () { mLines.Clear(); }

Awesome Thanks !  :)

44
It will just stay forever...

45
I see, thanks for the information it helps me a lot  :)

Pages: 1 2 [3] 4 5 6