Пример #1
0
 private void LateUpdate()
 {
     if (Application.IsPlaying(gameObject))
     {
         m_ParticleSystems = GetComponentsInChildren <ParticleSystem>();
         bool psPlaying = false;
         RecordDrawCall();
         RecordParticleCount();
         RecordFrameTime();
         RecordMemoryUsage();
         m_CurrentTime = Time.realtimeSinceStartup;
         foreach (var ps in m_ParticleSystems)
         {
             if (ps.isPlaying)
             {
                 psPlaying = true;
             }
         }
         if (!psPlaying)
         {
             m_PersistenceProfileResults.Append(m_ParticleSystemProfileResult);
             m_PersistenceProfileResults.Save();
             EditorApplication.isPlaying = false;
         }
     }
 }
Пример #2
0
 private void DetectParticleSystems()
 {
     UPRToolSetting.Instance.enableLuaProfiler = false;
     var profileResults = new ProfileResults(profileResultPath);
     profileResults.Save();
     EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo();
     EditorSceneManager.OpenScene(particlePlayScene);
     particleSystems = new List<GameObject>();
     particleSystemPaths = new List<string>();
     particleSystemElements = new List<ParticleSystemElement>
     {
         new ParticleSystemElement("", "", -1, 0)
     };
     var idCounter = 0;
     var allGameObjects = AssetDatabase.FindAssets("t:GameObject");
     foreach (var guid in allGameObjects)
     {
         var path = AssetDatabase.GUIDToAssetPath(guid);
         var gameObj = AssetDatabase.LoadAssetAtPath<GameObject>(path);
         if (gameObj.GetComponentsInChildren<ParticleSystem>().Length == 0) continue;
         idCounter++;
         particleSystems.Add(gameObj);
         particleSystemPaths.Add(path);
         particleSystemElements.Add(new ParticleSystemElement(path, "", 0, idCounter));
     }
     Debug.Log("Detected Particle Systems Count: " + particleSystems.Count);
     m_Initialized = false;
     InitIfNeeded();
 }