diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2020-08-20 23:40:50 -0400 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2020-08-20 23:40:50 -0400 |
| commit | 3af4c218c0e70167db23a6303d2af30aff37d2fe (patch) | |
| tree | 927f29edcf54ab562f40f3d1c6cb69287c7f5980 /Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_ObjectPool.cs | |
| parent | b6daed0af784f4e9bc13329dd87c671b06ee1c65 (diff) | |
| download | Project-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.tar.gz Project-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.tar.bz2 Project-Sandbox-3af4c218c0e70167db23a6303d2af30aff37d2fe.zip | |
Removed a bunch of stuff; Changes
Diffstat (limited to 'Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_ObjectPool.cs')
| -rw-r--r-- | Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_ObjectPool.cs | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_ObjectPool.cs b/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_ObjectPool.cs deleted file mode 100644 index 2340c39..0000000 --- a/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_ObjectPool.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.Events;
-
-
-namespace TMPro
-{
-
- internal class TMP_ObjectPool<T> where T : new()
- {
- private readonly Stack<T> m_Stack = new Stack<T>();
- private readonly UnityAction<T> m_ActionOnGet;
- private readonly UnityAction<T> m_ActionOnRelease;
-
- public int countAll { get; private set; }
- public int countActive { get { return countAll - countInactive; } }
- public int countInactive { get { return m_Stack.Count; } }
-
- public TMP_ObjectPool(UnityAction<T> actionOnGet, UnityAction<T> actionOnRelease)
- {
- m_ActionOnGet = actionOnGet;
- m_ActionOnRelease = actionOnRelease;
- }
-
- public T Get()
- {
- T element;
- if (m_Stack.Count == 0)
- {
- element = new T();
- countAll++;
- }
- else
- {
- element = m_Stack.Pop();
- }
- if (m_ActionOnGet != null)
- m_ActionOnGet(element);
- return element;
- }
-
- public void Release(T element)
- {
- if (m_Stack.Count > 0 && ReferenceEquals(m_Stack.Peek(), element))
- Debug.LogError("Internal error. Trying to destroy object that is already released to pool.");
- if (m_ActionOnRelease != null)
- m_ActionOnRelease(element);
- m_Stack.Push(element);
- }
- }
-}
\ No newline at end of file |
