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

Pages: [1] 2 3
1
NGUI 3 Support / Re: UIDragScrollView.OnDisable() perf question
« on: July 24, 2017, 08:25:11 PM »
That relieves the massive alloc from DestroyChildren() down to 0b. It's still a time sink (about 40% of total fame time), which is reasonable as (in this case) I'm destroying 553 compound widgets.

Of course, I'm not going to allow this many items in the list during normal operations. I was testing to find the sweet spot when I noticed the memory consumption.

Will you be making this change to the codebase?  If so, I'll just leave this tweak in and forget about it and the next upgrade will magically cause no issues.   :D

2
NGUI 3 Support / Re: UIDragScrollView.OnDisable() perf question
« on: July 23, 2017, 09:06:38 PM »
Here is a Profiler view.  Don't worry about the 40s time, this is a Deep Profile.

This was a 400 element list in a scrollview and it alloc'd 453mb, over 255mb worth in CalcRelativeWidgetBounds().   :D

3
NGUI 3 Support / UIDragScrollView.OnDisable() perf question
« on: July 23, 2017, 08:37:06 PM »
Is this OnDisable() even necessary to have?  It allocs a bunch of junk for the GC to clean up.  With a very large number of elements, I'm seeing 80+ % in 2 second frames when destroying and recreating lists.  :(

4
NGUI 3 Support / Re: NGUI and Vectrosity
« on: July 23, 2017, 08:28:59 PM »
Some more notes, as I haven't messed with this in awhile:

- Learn the Vectrosity documentation.  The product has a ton of features and different ways to use them.  The Coding.pdf, in particular, is extremely useful.

- I don't remember the reason, but I think creating the points list at the beginning with v3.zero and v3.one was necessary.  When you set the array a few lines down (in my code) is when the actual positions of source and target are set.  Since you just want straight lines, use a 2 element array and don't call Resize or MakeCurve.  The 2nd and 4th elements are for the curve control points.

5
NGUI 3 Support / Re: NGUI and Vectrosity
« on: July 23, 2017, 07:45:35 PM »
Yup, check the layers. 

I think the problem is with moving the canvas location.  I had to try many, many different ways of locating things to get Vectrosity and NGUI to line up properly.  They may be seen by the same UI camera, but not seeing them properly.

Note that NGUI and Vectrosity use different rendering methods with Vectrosity on Unity canvasses.  When running the game, be sure your scene view is in 3d mode and move your scene view around to note parallax changes between the different rendering methods. 

6
Yup, that's what I was thinking, too.  Ah well. 

Maybe this post will help somebody save some time.  Recovery is tricky, but doable.

7
I may have not nailed down the cause.  This was my current guess.  The event is quite rare and not something I want to experiment with.   ::)

8
I just came across an event that has happened to me maybe four times in the last two years.  It's very rare, but is a colossal pain in the butt when it happens.  I'll share my experience and maybe it will help down the road.

Event: may be more causes, but from what I've deduced: if you close Unity when there is a compilation error in your code, on reopening Unity, all NGUI prefabs will have lost their data (all of it!).

The first time this happened to me, I set about manually resetting all the data that was lost.  It took me several days to recover.

Current fix: I just discovered that you can manually walk your tree, go each prefab, click Revert and then immediately Undo (ctrl+z).  This will restore your data to the values that were present before.  UILabels that had NGUI fonts assigned will still say they are Unity fonts, but if you click to another GameObject and then back again, the data will show properly.

Moral: do not close Unity with code that won't compile.

I hope this helps somebody, or perhaps it might spark some further discussion or give Aren an "ah-ha" moment.... :)

9
NGUI 3 Support / Small Bug in UIPopupList
« on: October 22, 2016, 04:27:09 PM »
If your popup list is on a panel that has a changed sorting order, the created panel will appear on sorting order 0.

I added this just after panel creation at ~903:

  1.                 mChild.GetComponent<UIPanel>().sortingOrder = NGUITools.FindInParents<UIPanel>(gameObject).sortingOrder;
  2.  

10
NGUI 3 Support / Re: NGUI and Vectrosity
« on: October 22, 2016, 09:20:52 AM »
A note about renderqueue:

In my experimentation, to get proper layering/masking/clipping of vectorline objects, I think the best way to go is set each line material's renderqueue to be > any NGUI object and use UIPanel's sort order to affect layering of canvasses.  Vectrosity's default canvas sort order is 1.  NGUI panels at 0 are under lines and panels at 2 and up overlay lines. 

This may cost a few extra draw calls, as panels are "units of draw calls" but it's not enough to cause a real fps drop, from what I can see.

11
NGUI 3 Support / NGUI and Vectrosity
« on: October 20, 2016, 06:26:05 PM »
If you are working with Vectrosity, the line drawing asset, you can use this to get started:

  1. using UnityEngine;
  2. using Vectrosity;
  3. using System.Collections.Generic;
  4.  
  5. public class LineDrawer : MonoBehaviour
  6. {
  7.     public List<Vector3> points;
  8.     private Vector3[] curvePoints = new Vector3[4];
  9.  
  10.     public GameObject sourceGO;
  11.     public GameObject targetGO;
  12.     public Color lineColor = Color.red;
  13.     private Color _setColor = Color.white;
  14.  
  15.     public Camera unityCamera;
  16.  
  17.     //create and assign a standard material, set smoothness source to "Albedo Alpha", set smoothness to 0
  18.     public Material lineMaterial;
  19.  
  20.     private Vector3 sourcePosition;
  21.     private Vector3 targetPosition;
  22.  
  23.     private VectorLine myLine;
  24.  
  25.     private void Start()
  26.     {
  27.         //set these items before any VectorLine is created
  28.  
  29.         VectorLine.SetCamera3D(unityCamera);
  30.  
  31.         //we need to set the canvas to be at the same location as the NGUI screen area
  32.         VectorLine.canvas.renderMode = RenderMode.WorldSpace;
  33.         VectorLine.canvas.transform.position = Vector3.zero;
  34.         //on UIRoot, set Constrained Scaling Style
  35.         VectorLine.canvas.scaleFactor = NGUITools.FindInParents<UIRoot>(this.gameObject).gameObject.transform.localScale.x;
  36.  
  37.  
  38.  
  39.        
  40.  
  41.         if(sourceGO == null | targetGO == null)
  42.         {
  43.             Debug.LogError("Set your source and target GOs.");
  44.             return;
  45.         }
  46.  
  47.         points =new List<Vector3> { Vector3.zero, Vector3.one };
  48.  
  49.         myLine = new VectorLine("myLine", points, 5f, LineType.Continuous);
  50.         myLine.Resize(50);
  51.  
  52.         //setting renderqueue > 3000 will draw in front of all NGUI objects
  53.         lineMaterial.renderQueue = 4000;
  54.         lineMaterial.SetColor("_Color", Color.red);
  55.         lineMaterial.SetColor("_EmissionColor", Color.red);
  56.  
  57.         myLine.material = lineMaterial;
  58.        
  59.  
  60.         myLine.Draw3DAuto();
  61.  
  62.     }
  63.  
  64.     private void Update()
  65.     {
  66.         if(sourceGO == null | targetGO == null)
  67.             return;
  68.  
  69.         if(sourceGO.transform.localPosition != sourcePosition |
  70.             targetGO.transform.localPosition != targetPosition)
  71.         {
  72.             sourcePosition = sourceGO.transform.position;
  73.             targetPosition = targetGO.transform.position;
  74.  
  75.             Vector3 pos1 = new Vector3(sourcePosition.x, sourcePosition.y, sourcePosition.z);
  76.             Vector3 pos2 = new Vector3(targetPosition.x, targetPosition.y, targetPosition.z);
  77.  
  78.             curvePoints[0] = pos1;// sourcePosition;
  79.             curvePoints[1] = (pos1 + new Vector3(0.3f, 0f, 0f));
  80.             curvePoints[2] = pos2;
  81.             curvePoints[3] = (pos2 + new Vector3(0f, 0.3f, 0f));
  82.  
  83.             myLine.MakeCurve(curvePoints);
  84.  
  85.         }
  86.  
  87.         if(_setColor != lineColor)
  88.         {
  89.             lineMaterial.renderQueue = 4000;
  90.             lineMaterial.SetColor("_Color", lineColor);
  91.             lineMaterial.SetColor("_EmissionColor", lineColor);
  92.  
  93.             myLine.material = lineMaterial;
  94.         }
  95.     }
  96. }
  97.  
  98.  

12
NGUI 3 Support / Re: UIPopupList getting/setting value
« on: July 17, 2016, 08:23:58 PM »
Even with the line commented out, notify = false calls still do not set the value properly.

I worked around it.   ;)

13
NGUI 3 Support / Re: UIPopupList getting/setting value
« on: July 17, 2016, 06:24:47 PM »
Doesn't setting mSelectedItem to null make this function worthless for notify = false calls?

I can comment it out, too. But, I think this is not fully thought out.

14
NGUI 3 Support / Re: Fun with EventDelegates
« on: September 09, 2015, 09:31:13 AM »
How about extending EventDelegate to add static parameter values?  I think this would be very powerful.  As it is now, this can be approximated by having SetChecked() and SetUnchecked() methods or exposing simple values as member variables: public bool bTrue = true; public bFalse = false;.  This example is just for bool variables, others for strings or enums would be even more powerful.

Thoughts?

15
NGUI 3 Support / Re: Fun with EventDelegates
« on: September 06, 2015, 05:56:58 PM »
I have had this written for awhile. I remember Execute(List<EventDelegate>) not being available when I wrote this.  I'm pretty sure it was handled internally in EventDelegate.cs before.  Nice that it's there now, I can clean up my code.

Pages: [1] 2 3