Fixes to TextPic to make sure images are culled properly.
parent
d6bb530fee
commit
561cc87cf0
|
@ -180,7 +180,7 @@ namespace UnityEngine.UI.Extensions {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// If there are no matches, remove the images from the pool
|
// If there are no matches, remove the images from the pool
|
||||||
for (int i = 0; i < m_ImagesPool.Count; i++) {
|
for (int i = m_ImagesPool.Count - 1; i > 0; i--) {
|
||||||
if (m_ImagesPool[i]) {
|
if (m_ImagesPool[i]) {
|
||||||
if (!culled_ImagesPool.Contains(m_ImagesPool[i].gameObject)) {
|
if (!culled_ImagesPool.Contains(m_ImagesPool[i].gameObject)) {
|
||||||
culled_ImagesPool.Add(m_ImagesPool[i].gameObject);
|
culled_ImagesPool.Add(m_ImagesPool[i].gameObject);
|
||||||
|
@ -191,7 +191,8 @@ namespace UnityEngine.UI.Extensions {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove any images that are not being used
|
// Remove any images that are not being used
|
||||||
for (var i = matches.Count; i < m_ImagesPool.Count; i++) {
|
for (int i = m_ImagesPool.Count - 1; i >= matches.Count; i--) {
|
||||||
|
if (i >= 0 && m_ImagesPool.Count > 0) {
|
||||||
if (m_ImagesPool[i]) {
|
if (m_ImagesPool[i]) {
|
||||||
if (!culled_ImagesPool.Contains(m_ImagesPool[i].gameObject)) {
|
if (!culled_ImagesPool.Contains(m_ImagesPool[i].gameObject)) {
|
||||||
culled_ImagesPool.Add(m_ImagesPool[i].gameObject);
|
culled_ImagesPool.Add(m_ImagesPool[i].gameObject);
|
||||||
|
@ -199,6 +200,7 @@ namespace UnityEngine.UI.Extensions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Clear the images when it is safe to do so
|
// Clear the images when it is safe to do so
|
||||||
if (culled_ImagesPool.Count > 0) {
|
if (culled_ImagesPool.Count > 0) {
|
||||||
|
@ -514,7 +516,7 @@ namespace UnityEngine.UI.Extensions {
|
||||||
// Disable images on TextPic disable
|
// Disable images on TextPic disable
|
||||||
if (m_ImagesPool.Count >= 1) {
|
if (m_ImagesPool.Count >= 1) {
|
||||||
for (int i = 0; i < m_ImagesPool.Count; i++) {
|
for (int i = 0; i < m_ImagesPool.Count; i++) {
|
||||||
if(m_ImagesPool[i] != null) {
|
if (m_ImagesPool[i] != null) {
|
||||||
m_ImagesPool[i].enabled = false;
|
m_ImagesPool[i].enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue