Improve memory behaviour by pre-allocating the right amount of memory.
--HG-- branch : liortal/improve-memory-behaviour-by-preallocatin-1444835033293pull/413/head
parent
91dc0e06e1
commit
0845316a6c
|
@ -8,6 +8,9 @@ namespace UnityEngine.UI.Extensions
|
||||||
[AddComponentMenu("UI/Effects/Extensions/Nicer Outline")]
|
[AddComponentMenu("UI/Effects/Extensions/Nicer Outline")]
|
||||||
public class NicerOutline : BaseMeshEffect
|
public class NicerOutline : BaseMeshEffect
|
||||||
{
|
{
|
||||||
|
// A constant factor used when allocating the vertex list.
|
||||||
|
private const int GROWTH_FACTOR = 24;
|
||||||
|
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
private Color m_EffectColor = new Color (0f, 0f, 0f, 0.5f);
|
private Color m_EffectColor = new Color (0f, 0f, 0f, 0.5f);
|
||||||
|
|
||||||
|
@ -128,7 +131,7 @@ namespace UnityEngine.UI.Extensions
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List < UIVertex > verts = new List<UIVertex>();
|
List < UIVertex > verts = new List<UIVertex>(GROWTH_FACTOR * mesh.vertices.Length);
|
||||||
using (var helper = new VertexHelper(mesh))
|
using (var helper = new VertexHelper(mesh))
|
||||||
{
|
{
|
||||||
helper.GetUIVertexStream(verts);
|
helper.GetUIVertexStream(verts);
|
||||||
|
|
Loading…
Reference in New Issue