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 - r.pedra

Pages: [1] 2 3 ... 9
1
Dev Blog / Re: November 2nd, 2016
« on: November 02, 2016, 09:59:47 AM »
Top of the boxes looks really flat. It feels a little bit outdated. I don't know if this asset is intended to bu displayed multiple times on the screen so you need it to have a very low tri-count, but at the moment, from this angle of camera, it is very flat.


All of this is still great work !

2
NGUI 3 Support / Re: I2 SmartEdge is now in BETA
« on: October 26, 2016, 04:20:10 AM »
It looks truly amazing  :o

3
NGUI 3 Support / UIGrid problem with new SqrMagnitude on low end devices
« on: August 11, 2016, 12:54:01 PM »
Hi Aren,
Second message of the day ahah.

We had some weird problem on our project with the new Vector3.SqrMagnitude you made in UIGrid.ResetPosition.

Here is our setup:

-UIGrid

-Transform
----Widget
----Widget
----Widget
----Widget

When we do our animation, we want each widget to be repositioned. To do so, we use the AddWidget from UIGrid to parent it to the grid.
After that we call UIGrid.Reposition().
Since we have checked animate smoothly, the widget is smoothly going to the Zero point under the grid.
Everything fine.
Then, 0.3 second after the first one have been add to the grid, we resize the grid and we add another widget and call reposition too.

Everything is fine when the framerate is stable.
But when it's not stable, the first widget almost always stays stuck in the center of the grid. Calling Reposition when the framerate is more stable doesn't replace it correctly.
The only way I made it to work is by disabling the Vector3.SqrMagnitude.
In our setup the grid have a width of 175, the widget is stuck in 0,0,0 and the SpringPosition wants to move it to x:-1750 instead of x:-350, but it doesn't move anyway.

This is our code calling doing the animation:
  1.         private IEnumerator DrawCardsAsync(){
  2.                 for (int i = 0; i < _result.bonusesActivated.Length; i++){
  3.                        
  4.                         cards[i].Init(_result.bonusesActivated[i],GridToRepositionAfterContentUpdate.transform);
  5.                         GridToUpdateWithBonuses.ExecuteUpdateAction();
  6.  
  7.                         GridToRepositionAfterContentUpdate.Reposition();
  8.                         yield return new WaitForSeconds(0.3f);
  9.                 }
  10.         }

ExcuteUpdateAction is in this script:
  1. using UnityEngine;
  2.  
  3. using System.Collections;
  4. using System.Collections.Generic;
  5.  
  6. [ExecuteInEditMode]
  7. public class UIGridFollowsResize : MonoBehaviour
  8. {
  9.         private UIWidget m_Widget;
  10.         private UIPanel m_Panel;
  11.         private UIGrid m_uiGrid;
  12.         public float numOfColumns = 4.0f;
  13.         public float numOfRows = 3.0f;
  14.  
  15.         private List<Transform> m_childList = new List<Transform>();
  16.  
  17.         void Start()
  18.         {
  19.                 m_Widget = GetComponent<UIWidget>();
  20.                 m_uiGrid = GetComponent<UIGrid>();
  21.         }
  22.  
  23.         public void updateGrid()
  24.         {
  25.                 if (m_uiGrid == null) return;
  26.  
  27.  
  28.                 float newHeight;
  29.                 float newWidth;
  30.                 float newScale;
  31.                 if (numOfRows > 0)
  32.                 {
  33.                         newHeight = m_Widget.height / numOfRows;
  34.                 }else{
  35.                         newHeight = 0;
  36.                 }
  37.                 newWidth = m_Widget.width / numOfColumns;
  38.  
  39.                 m_uiGrid.cellWidth = newWidth ;
  40.                 m_uiGrid.cellHeight = newHeight;
  41.  
  42.                 m_childList = m_uiGrid.GetChildList();
  43.                 foreach (Transform child in m_childList)
  44.                 {
  45.  
  46.                         UIWidget childWidget = child.GetComponent<UIWidget>();
  47.                         if((newWidth - (AMTools.isHD ? 80f : 40f)) / childWidget.width < (newHeight - (AMTools.isHD ? 60f : 30f)) / childWidget.height){
  48.                                 newScale = (newWidth - (AMTools.isHD ? 80f : 40f)) / childWidget.width;
  49.                         }else{
  50.                                 newScale = (newHeight - (AMTools.isHD ? 60f : 30f)) / childWidget.height;
  51.                         }
  52.  
  53.                         child.localScale = Vector3.one * newScale;
  54.                 }
  55.         }
  56.  
  57.         void Update()
  58.         {
  59.                 if (m_Panel == null) m_Panel = m_Widget.panel;
  60.         }
  61.  
  62.         public void ExecuteUpdateAction(){
  63.  
  64.                 updateGrid();
  65.         }
  66.  
  67.         public bool update = false;
  68.         void OnValidate(){
  69.                 if(update == true){
  70.                         updateGrid();
  71.                         update = false;
  72.                 }
  73.         }
  74. }
  75.  
Init is doing this with the transform(and other thing but not related to the transform):
  1.         public void Init(APIJSON.SHOP.CARDHOLDER.BonusesActivated bonus, Transform moveParentingTo){
  2.                 _bonus = bonus;
  3.                 Debug.Log("Bonus:" + JsonUtility.ToJson(_bonus));
  4.                 if(firstParent == null){
  5.                         firstParent = this.transform.parent;
  6.                 }
  7.                 moveParentingTo.GetComponent<UIGrid>().AddChild(this.transform);
  8.  
  9.                 this.gameObject.SetActive(true);
  10. }


To simulate the hiccups of the device we made a dirty function:
  1.         int nbLags = 0;
  2.         private IEnumerator LagsPeriodically()
  3.         {
  4.                 int i = 0;
  5.                 while (i < 1000)
  6.                 {
  7.                         Debug.Log("LOG");
  8.                         i++;
  9.                 }
  10.  
  11.                 nbLags++;
  12.                 yield return new WaitForSeconds(0.4f);
  13.                 if (nbLags < 5)
  14.                 {
  15.                         StartCoroutine(LagsPeriodically());
  16.                 }else{
  17.                         nbLags = 0;
  18.                 }
  19.         }

Can you take a look at it and tell us if you have the same problem?

4
NGUI 3 Support / High CPU in Editor-only on 3.10.0
« on: August 11, 2016, 07:58:59 AM »
Hi Aren,
We updated recently to the last NGUI update (we were 5 or 6 update behind).
Since this day, scene view is almost unusable because when we move some objects around, CPU increase to 100% during all the move.
We did a profile of the editor and linked the result to this topic.

At first we thought it was because you call Profiler.BeginSample in an ExecuteInEditMode script but after removing it we have the same problem.
We are on Unity 5.3.6p2 and this bug is very annoying because we can't place our widgets properly like before.

Do you have the same problem on your side?

5
NGUI 3 Support / Re: Any way to optimize CalculateRelativeWidgetBounds ?
« on: August 01, 2016, 03:58:39 AM »
When you say "run-time", do you mean on device? Because I'm almost 100% sure, it still generates garbage. I will check.

6
NGUI 3 Support / Any way to optimize CalculateRelativeWidgetBounds ?
« on: July 29, 2016, 08:42:30 AM »
Hi,
We have a list of cards in our game.
These cards are displayed in an UIGrid with SmoothTween enabled.
We are trying to do a nice animation with these cards. Every time we add one to the grid(+0.4s), we reposition the grid:


The problem is that we have a scrollbar, and it triggers the CalculateRelativeWidgetBounds function. Since it's a recursive function on all the widgets underneath the panel, it is called 11 000 times !!!! (We have about 50 cards, with one background, an icon, the foreground, and 1 or 2 UILabel)

In our example, we tried to do it progressively, but it started with 0kb of garbage generated and ended with 6Mb of garbage during the last card animation. 6Mb !!!!!!!
We tried to do it instantly on all the cards by giving up the progressive effect (and loose a nice card distribution effect) but the frame still generates 6Mb of garbage.

Do you have an idea on how we can optimize this or change something in our setup to optimize it?

Thank you for your help.


EDIT: I would like to add that this is the GetComponent<UIPanel> on each widget that is generating so much garbage. Would it be possible to cache it and reuse it every time ?

7
I had one case, after loading a new scene.
If the memory of the phone is saturated, and you load a new scene, all is black after scene loading. Try reduce memory usage. You can compress your atlases at max supported compression, and retry to display your scene. If the compression fixes the problem, it is likely a memory problem

8
NGUI 3 Support / Re: Zoom problem
« on: July 25, 2016, 08:59:59 AM »
What you are saying is not understandable. We can't help you if we don't understand.

Moreover there are no "Hello" or "Thanks for your help in advance".
You say that when you click on screen, controls (??????) zoom in, but what do you mean by zoom in? And what do you call controls? Do you mean Widgets?

Don't act as a *******bag and ask a real and clear question with correct language.

9
I suppose, iOS have events for when you start recording and stop recording.
You can SendMessage to Unity from ObjC code to tell Unity that the record have started/stopped and hide or display your UI depending on that.

10
Misc Archive / Re: Shattered Throne, made with NGUI
« on: June 08, 2016, 09:50:17 AM »
This game seems to be really good. Advance Wars in Fantastic world. Keep going, this is very promising. Are you alone programming this game?

11
Misc Archive / Re: Dawnbringer - Made with NGUI
« on: June 01, 2016, 11:18:17 AM »
Looks very nice !
Combat gameplay reminds a little bit of Infinity Blade.

12
NGUI 3 Support / Re: NGUI Inflate Looping issue
« on: May 21, 2016, 11:46:10 AM »
I've never used UIWrapContent so I don't know how it works.
Another advice, remember to remove your Debug.Log instructions in loop, especially when there are a lot if items. Debug.Log take a loooooooot of time to execute(Because it spams the log file multiple time a frame in your case)

13
NGUI 3 Support / Re: NGUI Inflate Looping issue
« on: May 20, 2016, 03:28:29 AM »
More something like that
  1. public IEnumerator CreateShopItems() {
  2.        
  3.         for (int i = 0; i < dataList.Count; i++) {
  4.                 if(i%10 == 0){
  5.                          yield return null;
  6.                 }                                
  7.                 GameObject item = NGUITools.AddChild(uiGrid.gameObject, flingerItemPrefab);
  8.                 Debug.Log(Time.deltaTime);
  9.         }
  10. }

Then you reposition and after repositioning, you activate all the item/parent in a loop.(If you used the hierarchy i gave you)
I tried to activate childrens in a Coroutine but it was slower and I had more freezes than if I make it in one frame.

14
NGUI 3 Support / Re: NGUI Inflate Looping issue
« on: May 19, 2016, 04:03:22 AM »
You could make a loading indicator and load all the things in a Coroutine. Let's say you load them 10 per 10 (using yield every i %10 == 0).
What I also saw is that if you disable all the content of your prefab before repositioning grid and activate all just after, the reposition is faster.
Your item should look like this:
item
    parent
        content
        content
        content

You disable parent in your prefab and activate it after reposition.
I have lists of 400 items that take 2 or 3 seconds to load almost without freeze on mobile.

15
Dev Blog / Re: Apr 2, 2016 - In pursuit of better skies
« on: May 03, 2016, 04:53:21 AM »
It looks so easy for you...

Pages: [1] 2 3 ... 9