void OnResourceManagerDiagnosticEvent(AsyncOperationHandle op, ResourceManager.DiagnosticEventType type, int eventValue, object context)
        {
            var            hashCode = op.GetHashCode();
            DiagnosticInfo diagInfo = null;

            if (type == ResourceManager.DiagnosticEventType.AsyncOperationDestroy)
            {
                if (m_cachedDiagnosticInfo.TryGetValue(hashCode, out diagInfo))
                {
                    m_cachedDiagnosticInfo.Remove(hashCode);
                }
            }
            else
            {
                if (!m_cachedDiagnosticInfo.TryGetValue(hashCode, out diagInfo))
                {
                    m_dependencyBuffer.Clear();
                    op.GetDependencies(m_dependencyBuffer);
                    var depIds = new int[m_dependencyBuffer.Count];
                    for (int i = 0; i < depIds.Length; i++)
                    {
                        depIds[i] = m_dependencyBuffer[i].GetHashCode();
                    }
                    m_cachedDiagnosticInfo.Add(hashCode, diagInfo = new DiagnosticInfo()
                    {
                        ObjectId = hashCode, DisplayName = op.DebugName, Dependencies = depIds
                    });
                }
            }

            m_eventCollector.PostEvent(diagInfo.CreateEvent("ResourceManager", type, Time.frameCount, eventValue));
        }
Example #2
0
 internal void PostDiagnosticEvent(AsyncOperationHandle op, ResourceManager.DiagnosticEventType type, int eventValue = 0, object context = null)
 {
     if (m_diagnosticsHandler == null)
     {
         return;
     }
     m_diagnosticsHandler(op, type, eventValue, context);
 }
 public DiagnosticEvent CreateEvent(string category, ResourceManager.DiagnosticEventType eventType, int frame, int val)
 {
     return(new DiagnosticEvent(category, DisplayName, ObjectId, (int)eventType, frame, val, Dependencies));
 }
 private DiagnosticEvent CreateNewGenericEvent(ResourceManager.DiagnosticEventType eventType, int frame, int value, int id, int[] dependencies)
 {
     return(new DiagnosticEvent(null, "GenericEvent", id, (int)eventType, frame, value, dependencies));
 }
 private DiagnosticEvent CreateNewGenericEvent(ResourceManager.DiagnosticEventType eventType, int frame, int value)
 {
     return(new DiagnosticEvent(null, "GenericEvent", 1000, (int)eventType, frame, value, null));
 }