com.elestrago.unity.entitas-redux 3.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/CHANGELOG.md +354 -0
  2. package/CHANGELOG.md.meta +7 -0
  3. package/Docs/EntitasReduxAPI.chm +0 -0
  4. package/Docs/EntitasReduxAPI.chm.meta +7 -0
  5. package/Docs/Images/portrait.png +0 -0
  6. package/Docs/Images/portrait.png.meta +91 -0
  7. package/Docs/Images/social_share_image.png +0 -0
  8. package/Docs/Images/social_share_image.png.meta +91 -0
  9. package/Docs/Images.meta +8 -0
  10. package/Docs.meta +8 -0
  11. package/LICENSE.md +21 -0
  12. package/LICENSE.md.meta +7 -0
  13. package/Licenses/LICENSE.txt +21 -0
  14. package/Licenses/LICENSE.txt.meta +7 -0
  15. package/Licenses/SCHMID_LICENSE.txt +22 -0
  16. package/Licenses/SCHMID_LICENSE.txt.meta +7 -0
  17. package/Licenses.meta +8 -0
  18. package/Plugins/EntitasRedux.Command.Generator.dll +0 -0
  19. package/Plugins/EntitasRedux.Command.Generator.dll.meta +89 -0
  20. package/Plugins/EntitasRedux.Core.Generator.dll +0 -0
  21. package/Plugins/EntitasRedux.Core.Generator.dll.meta +89 -0
  22. package/Plugins/EntitasRedux.Core.Libs.dll +0 -0
  23. package/Plugins/EntitasRedux.Core.Libs.dll.meta +75 -0
  24. package/Plugins/EntitasRedux.Core.dll +0 -0
  25. package/Plugins/EntitasRedux.Core.dll.meta +75 -0
  26. package/Plugins.meta +8 -0
  27. package/README.md +106 -0
  28. package/README.md.meta +7 -0
  29. package/Scripts/AssemblyInfo.cs +39 -0
  30. package/Scripts/AssemblyInfo.cs.meta +11 -0
  31. package/Scripts/Blueprints/AssemblyInfo.cs +39 -0
  32. package/Scripts/Blueprints/AssemblyInfo.cs.meta +11 -0
  33. package/Scripts/Blueprints/BlueprintBase.cs +66 -0
  34. package/Scripts/Blueprints/BlueprintBase.cs.meta +11 -0
  35. package/Scripts/Blueprints/BlueprintBehaviourBase.cs +63 -0
  36. package/Scripts/Blueprints/BlueprintBehaviourBase.cs.meta +11 -0
  37. package/Scripts/Blueprints/Editor/AssemblyInfo.cs +35 -0
  38. package/Scripts/Blueprints/Editor/AssemblyInfo.cs.meta +11 -0
  39. package/Scripts/Blueprints/Editor/BlueprintBaseInspector.cs +67 -0
  40. package/Scripts/Blueprints/Editor/BlueprintBaseInspector.cs.meta +11 -0
  41. package/Scripts/Blueprints/Editor/BlueprintBehaviourBaseInspector.cs +67 -0
  42. package/Scripts/Blueprints/Editor/BlueprintBehaviourBaseInspector.cs.meta +11 -0
  43. package/Scripts/Blueprints/Editor/BlueprintInspector.cs +268 -0
  44. package/Scripts/Blueprints/Editor/BlueprintInspector.cs.meta +11 -0
  45. package/Scripts/Blueprints/Editor/EntitasRedux.Blueprints.Editor.asmdef +20 -0
  46. package/Scripts/Blueprints/Editor/EntitasRedux.Blueprints.Editor.asmdef.meta +7 -0
  47. package/Scripts/Blueprints/Editor.meta +8 -0
  48. package/Scripts/Blueprints/EntitasRedux.Blueprints.asmdef +15 -0
  49. package/Scripts/Blueprints/EntitasRedux.Blueprints.asmdef.meta +7 -0
  50. package/Scripts/Blueprints.meta +8 -0
  51. package/Scripts/Core/Utils/UnsubscribeEvent.cs +20 -0
  52. package/Scripts/Core/Utils/UnsubscribeEvent.cs.meta +3 -0
  53. package/Scripts/Core/Utils/UnsubscribeEventExtensions.cs +13 -0
  54. package/Scripts/Core/Utils/UnsubscribeEventExtensions.cs.meta +3 -0
  55. package/Scripts/Core/Utils.meta +3 -0
  56. package/Scripts/Core/View/IEntityHashHolder.cs +7 -0
  57. package/Scripts/Core/View/IEntityHashHolder.cs.meta +3 -0
  58. package/Scripts/Core/View/ILinkable.cs +9 -0
  59. package/Scripts/Core/View/ILinkable.cs.meta +3 -0
  60. package/Scripts/Core/View/Impls/EntityHashHolder.cs +11 -0
  61. package/Scripts/Core/View/Impls/EntityHashHolder.cs.meta +3 -0
  62. package/Scripts/Core/View/Impls/LinkableView.Editor.cs +41 -0
  63. package/Scripts/Core/View/Impls/LinkableView.Editor.cs.meta +3 -0
  64. package/Scripts/Core/View/Impls/LinkableView.cs +99 -0
  65. package/Scripts/Core/View/Impls/LinkableView.cs.meta +3 -0
  66. package/Scripts/Core/View/Impls.meta +3 -0
  67. package/Scripts/Core/View.meta +3 -0
  68. package/Scripts/Core.meta +8 -0
  69. package/Scripts/Editor/AssemblyInfo.cs +39 -0
  70. package/Scripts/Editor/AssemblyInfo.cs.meta +11 -0
  71. package/Scripts/Editor/CreateScriptMenuItems.cs +89 -0
  72. package/Scripts/Editor/CreateScriptMenuItems.cs.meta +11 -0
  73. package/Scripts/Editor/EntitasRedux.Editor.asmdef +18 -0
  74. package/Scripts/Editor/EntitasRedux.Editor.asmdef.meta +7 -0
  75. package/Scripts/Editor/EntitasReduxStyles.cs +65 -0
  76. package/Scripts/Editor/EntitasReduxStyles.cs.meta +11 -0
  77. package/Scripts/Editor/Extensions/ColorExtensions.cs +50 -0
  78. package/Scripts/Editor/Extensions/ColorExtensions.cs.meta +11 -0
  79. package/Scripts/Editor/Extensions/PublicMemberInfoExtensions.cs +60 -0
  80. package/Scripts/Editor/Extensions/PublicMemberInfoExtensions.cs.meta +11 -0
  81. package/Scripts/Editor/Extensions/SerializationTypeExtensions.cs +124 -0
  82. package/Scripts/Editor/Extensions/SerializationTypeExtensions.cs.meta +11 -0
  83. package/Scripts/Editor/Extensions/StringExtensions.cs +141 -0
  84. package/Scripts/Editor/Extensions/StringExtensions.cs.meta +11 -0
  85. package/Scripts/Editor/Extensions/TypeExtensions.cs +216 -0
  86. package/Scripts/Editor/Extensions/TypeExtensions.cs.meta +11 -0
  87. package/Scripts/Editor/Extensions.meta +8 -0
  88. package/Scripts/Editor/Images/EntitasContextErrorHierarchyIcon.png +0 -0
  89. package/Scripts/Editor/Images/EntitasContextErrorHierarchyIcon.png.meta +93 -0
  90. package/Scripts/Editor/Images/EntitasContextHierarchyIcon.png +0 -0
  91. package/Scripts/Editor/Images/EntitasContextHierarchyIcon.png.meta +93 -0
  92. package/Scripts/Editor/Images/EntitasEntityErrorHierarchyIcon.png +0 -0
  93. package/Scripts/Editor/Images/EntitasEntityErrorHierarchyIcon.png.meta +93 -0
  94. package/Scripts/Editor/Images/EntitasEntityHierarchyIcon.png +0 -0
  95. package/Scripts/Editor/Images/EntitasEntityHierarchyIcon.png.meta +93 -0
  96. package/Scripts/Editor/Images/EntitasEntityLinkHierarchyIcon.png +0 -0
  97. package/Scripts/Editor/Images/EntitasEntityLinkHierarchyIcon.png.meta +93 -0
  98. package/Scripts/Editor/Images/EntitasEntityLinkWarnHierarchyIcon.png +0 -0
  99. package/Scripts/Editor/Images/EntitasEntityLinkWarnHierarchyIcon.png.meta +93 -0
  100. package/Scripts/Editor/Images/EntitasHeader.png +0 -0
  101. package/Scripts/Editor/Images/EntitasHeader.png.meta +93 -0
  102. package/Scripts/Editor/Images/EntitasSystemsHierarchyIcon.png +0 -0
  103. package/Scripts/Editor/Images/EntitasSystemsHierarchyIcon.png.meta +93 -0
  104. package/Scripts/Editor/Images/EntitasSystemsWarnHierarchyIcon.png +0 -0
  105. package/Scripts/Editor/Images/EntitasSystemsWarnHierarchyIcon.png.meta +93 -0
  106. package/Scripts/Editor/Images.meta +8 -0
  107. package/Scripts/Editor/Inspector/DefaultInstanceCreator/DefaultArrayCreator.cs +43 -0
  108. package/Scripts/Editor/Inspector/DefaultInstanceCreator/DefaultArrayCreator.cs.meta +11 -0
  109. package/Scripts/Editor/Inspector/DefaultInstanceCreator/DefaultStringCreator.cs +42 -0
  110. package/Scripts/Editor/Inspector/DefaultInstanceCreator/DefaultStringCreator.cs.meta +11 -0
  111. package/Scripts/Editor/Inspector/DefaultInstanceCreator/IDefaultInstanceCreator.cs +36 -0
  112. package/Scripts/Editor/Inspector/DefaultInstanceCreator/IDefaultInstanceCreator.cs.meta +11 -0
  113. package/Scripts/Editor/Inspector/DefaultInstanceCreator.meta +8 -0
  114. package/Scripts/Editor/Inspector/Entity/EntityDrawer.cs +927 -0
  115. package/Scripts/Editor/Inspector/Entity/EntityDrawer.cs.meta +11 -0
  116. package/Scripts/Editor/Inspector/Entity/EntityInspector.cs +57 -0
  117. package/Scripts/Editor/Inspector/Entity/EntityInspector.cs.meta +11 -0
  118. package/Scripts/Editor/Inspector/Entity.meta +8 -0
  119. package/Scripts/Editor/Inspector/IComponentDrawer.cs +36 -0
  120. package/Scripts/Editor/Inspector/IComponentDrawer.cs.meta +11 -0
  121. package/Scripts/Editor/Inspector/TypeDrawer/AnimationCurveTypeDrawer.cs +44 -0
  122. package/Scripts/Editor/Inspector/TypeDrawer/AnimationCurveTypeDrawer.cs.meta +11 -0
  123. package/Scripts/Editor/Inspector/TypeDrawer/ArrayTypeDrawer.cs +282 -0
  124. package/Scripts/Editor/Inspector/TypeDrawer/ArrayTypeDrawer.cs.meta +11 -0
  125. package/Scripts/Editor/Inspector/TypeDrawer/BoolTypeDrawer.cs +43 -0
  126. package/Scripts/Editor/Inspector/TypeDrawer/BoolTypeDrawer.cs.meta +11 -0
  127. package/Scripts/Editor/Inspector/TypeDrawer/BoundsTypeDrawer.cs +44 -0
  128. package/Scripts/Editor/Inspector/TypeDrawer/BoundsTypeDrawer.cs.meta +11 -0
  129. package/Scripts/Editor/Inspector/TypeDrawer/CharTypeDrawer.cs +44 -0
  130. package/Scripts/Editor/Inspector/TypeDrawer/CharTypeDrawer.cs.meta +11 -0
  131. package/Scripts/Editor/Inspector/TypeDrawer/ColorTypeDrawer.cs +44 -0
  132. package/Scripts/Editor/Inspector/TypeDrawer/ColorTypeDrawer.cs.meta +11 -0
  133. package/Scripts/Editor/Inspector/TypeDrawer/DateTimeTypeDrawer.cs +49 -0
  134. package/Scripts/Editor/Inspector/TypeDrawer/DateTimeTypeDrawer.cs.meta +11 -0
  135. package/Scripts/Editor/Inspector/TypeDrawer/DictionaryTypeDrawer.cs +131 -0
  136. package/Scripts/Editor/Inspector/TypeDrawer/DictionaryTypeDrawer.cs.meta +11 -0
  137. package/Scripts/Editor/Inspector/TypeDrawer/DoubleTypeDrawer.cs +43 -0
  138. package/Scripts/Editor/Inspector/TypeDrawer/DoubleTypeDrawer.cs.meta +11 -0
  139. package/Scripts/Editor/Inspector/TypeDrawer/EnumTypeDrawer.cs +48 -0
  140. package/Scripts/Editor/Inspector/TypeDrawer/EnumTypeDrawer.cs.meta +11 -0
  141. package/Scripts/Editor/Inspector/TypeDrawer/FloatTypeDrawer.cs +43 -0
  142. package/Scripts/Editor/Inspector/TypeDrawer/FloatTypeDrawer.cs.meta +11 -0
  143. package/Scripts/Editor/Inspector/TypeDrawer/HashSetTypeDrawer.cs +124 -0
  144. package/Scripts/Editor/Inspector/TypeDrawer/HashSetTypeDrawer.cs.meta +11 -0
  145. package/Scripts/Editor/Inspector/TypeDrawer/ITypeDrawer.cs +36 -0
  146. package/Scripts/Editor/Inspector/TypeDrawer/ITypeDrawer.cs.meta +11 -0
  147. package/Scripts/Editor/Inspector/TypeDrawer/IntTypeDrawer.cs +43 -0
  148. package/Scripts/Editor/Inspector/TypeDrawer/IntTypeDrawer.cs.meta +11 -0
  149. package/Scripts/Editor/Inspector/TypeDrawer/ListTypeDrawer.cs +163 -0
  150. package/Scripts/Editor/Inspector/TypeDrawer/ListTypeDrawer.cs.meta +11 -0
  151. package/Scripts/Editor/Inspector/TypeDrawer/RectTypeDrawer.cs +44 -0
  152. package/Scripts/Editor/Inspector/TypeDrawer/RectTypeDrawer.cs.meta +11 -0
  153. package/Scripts/Editor/Inspector/TypeDrawer/StringTypeDrawer.cs +43 -0
  154. package/Scripts/Editor/Inspector/TypeDrawer/StringTypeDrawer.cs.meta +11 -0
  155. package/Scripts/Editor/Inspector/TypeDrawer/UnityObjectTypeDrawer.cs +49 -0
  156. package/Scripts/Editor/Inspector/TypeDrawer/UnityObjectTypeDrawer.cs.meta +11 -0
  157. package/Scripts/Editor/Inspector/TypeDrawer/Vector2TypeDrawer.cs +44 -0
  158. package/Scripts/Editor/Inspector/TypeDrawer/Vector2TypeDrawer.cs.meta +11 -0
  159. package/Scripts/Editor/Inspector/TypeDrawer/Vector3TypeDrawer.cs +44 -0
  160. package/Scripts/Editor/Inspector/TypeDrawer/Vector3TypeDrawer.cs.meta +11 -0
  161. package/Scripts/Editor/Inspector/TypeDrawer/Vector4TypeDrawer.cs +44 -0
  162. package/Scripts/Editor/Inspector/TypeDrawer/Vector4TypeDrawer.cs.meta +11 -0
  163. package/Scripts/Editor/Inspector/TypeDrawer.meta +8 -0
  164. package/Scripts/Editor/Inspector.meta +8 -0
  165. package/Scripts/Editor/MenuItems.cs +84 -0
  166. package/Scripts/Editor/MenuItems.cs.meta +11 -0
  167. package/Scripts/Editor/PlayModeHelper.cs +75 -0
  168. package/Scripts/Editor/PlayModeHelper.cs.meta +11 -0
  169. package/Scripts/Editor/Reflection/AttributeInfo.cs +44 -0
  170. package/Scripts/Editor/Reflection/AttributeInfo.cs.meta +11 -0
  171. package/Scripts/Editor/Reflection/PublicMemberInfo.cs +95 -0
  172. package/Scripts/Editor/Reflection/PublicMemberInfo.cs.meta +11 -0
  173. package/Scripts/Editor/Reflection.meta +8 -0
  174. package/Scripts/Editor/ScriptTemplates/CleanupSystem.txt +15 -0
  175. package/Scripts/Editor/ScriptTemplates/CleanupSystem.txt.meta +7 -0
  176. package/Scripts/Editor/ScriptTemplates/Component.txt +9 -0
  177. package/Scripts/Editor/ScriptTemplates/Component.txt.meta +7 -0
  178. package/Scripts/Editor/ScriptTemplates/FixedUpdateSystem.txt +15 -0
  179. package/Scripts/Editor/ScriptTemplates/FixedUpdateSystem.txt.meta +7 -0
  180. package/Scripts/Editor/ScriptTemplates/InitializeSystem.txt +15 -0
  181. package/Scripts/Editor/ScriptTemplates/InitializeSystem.txt.meta +7 -0
  182. package/Scripts/Editor/ScriptTemplates/LateUpdateSystem.txt +15 -0
  183. package/Scripts/Editor/ScriptTemplates/LateUpdateSystem.txt.meta +7 -0
  184. package/Scripts/Editor/ScriptTemplates/ReactiveSystem.txt +39 -0
  185. package/Scripts/Editor/ScriptTemplates/ReactiveSystem.txt.meta +7 -0
  186. package/Scripts/Editor/ScriptTemplates/UpdateSystem.txt +15 -0
  187. package/Scripts/Editor/ScriptTemplates/UpdateSystem.txt.meta +7 -0
  188. package/Scripts/Editor/ScriptTemplates.meta +8 -0
  189. package/Scripts/Editor/Tools/ColorTools.cs +59 -0
  190. package/Scripts/Editor/Tools/ColorTools.cs.meta +11 -0
  191. package/Scripts/Editor/Tools/EditorGUILayoutTools.cs +242 -0
  192. package/Scripts/Editor/Tools/EditorGUILayoutTools.cs.meta +11 -0
  193. package/Scripts/Editor/Tools/PlayerSettingsTools.cs +144 -0
  194. package/Scripts/Editor/Tools/PlayerSettingsTools.cs.meta +11 -0
  195. package/Scripts/Editor/Tools/PreferenceTools.cs +116 -0
  196. package/Scripts/Editor/Tools/PreferenceTools.cs.meta +11 -0
  197. package/Scripts/Editor/Tools/RefactorModeTools.cs +85 -0
  198. package/Scripts/Editor/Tools/RefactorModeTools.cs.meta +11 -0
  199. package/Scripts/Editor/Tools/ReflectionTools.cs +33 -0
  200. package/Scripts/Editor/Tools/ReflectionTools.cs.meta +3 -0
  201. package/Scripts/Editor/Tools/ScriptTools.cs +117 -0
  202. package/Scripts/Editor/Tools/ScriptTools.cs.meta +11 -0
  203. package/Scripts/Editor/Tools/SerializationTools.cs +91 -0
  204. package/Scripts/Editor/Tools/SerializationTools.cs.meta +11 -0
  205. package/Scripts/Editor/Tools.meta +8 -0
  206. package/Scripts/Editor/Window/AboutWindow.cs +153 -0
  207. package/Scripts/Editor/Window/AboutWindow.cs.meta +14 -0
  208. package/Scripts/Editor/Window.meta +8 -0
  209. package/Scripts/Editor.meta +8 -0
  210. package/Scripts/EntitasRedux.asmdef +13 -0
  211. package/Scripts/EntitasRedux.asmdef.meta +7 -0
  212. package/Scripts/Entity/EntityBehaviour.cs +82 -0
  213. package/Scripts/Entity/EntityBehaviour.cs.meta +11 -0
  214. package/Scripts/Entity.meta +8 -0
  215. package/Scripts/EntityLink.cs +85 -0
  216. package/Scripts/EntityLink.cs.meta +11 -0
  217. package/Scripts/Extensions/EntityLinkExtension.cs +52 -0
  218. package/Scripts/Extensions/EntityLinkExtension.cs.meta +11 -0
  219. package/Scripts/Extensions.meta +8 -0
  220. package/Scripts/VersionConstants.cs +58 -0
  221. package/Scripts/VersionConstants.cs.meta +11 -0
  222. package/Scripts/VisualDebugging/AssemblyInfo.cs +39 -0
  223. package/Scripts/VisualDebugging/AssemblyInfo.cs.meta +11 -0
  224. package/Scripts/VisualDebugging/ContextObserver/ContextObserver.cs +107 -0
  225. package/Scripts/VisualDebugging/ContextObserver/ContextObserver.cs.meta +11 -0
  226. package/Scripts/VisualDebugging/ContextObserver/ContextObserverBehaviour.cs +60 -0
  227. package/Scripts/VisualDebugging/ContextObserver/ContextObserverBehaviour.cs.meta +11 -0
  228. package/Scripts/VisualDebugging/ContextObserver/ContextObserverExtension.cs +47 -0
  229. package/Scripts/VisualDebugging/ContextObserver/ContextObserverExtension.cs.meta +11 -0
  230. package/Scripts/VisualDebugging/ContextObserver.meta +8 -0
  231. package/Scripts/VisualDebugging/DebugSystems/AvgResetInterval.cs +37 -0
  232. package/Scripts/VisualDebugging/DebugSystems/AvgResetInterval.cs.meta +11 -0
  233. package/Scripts/VisualDebugging/DebugSystems/DebugSystems.cs +477 -0
  234. package/Scripts/VisualDebugging/DebugSystems/DebugSystems.cs.meta +11 -0
  235. package/Scripts/VisualDebugging/DebugSystems/DebugSystemsBehaviour.cs +41 -0
  236. package/Scripts/VisualDebugging/DebugSystems/DebugSystemsBehaviour.cs.meta +11 -0
  237. package/Scripts/VisualDebugging/DebugSystems/SystemInfo.cs +347 -0
  238. package/Scripts/VisualDebugging/DebugSystems/SystemInfo.cs.meta +11 -0
  239. package/Scripts/VisualDebugging/DebugSystems.meta +8 -0
  240. package/Scripts/VisualDebugging/Editor/AssemblyInfo.cs +35 -0
  241. package/Scripts/VisualDebugging/Editor/AssemblyInfo.cs.meta +11 -0
  242. package/Scripts/VisualDebugging/Editor/ContextObserver/ContextObserverInspector.cs +104 -0
  243. package/Scripts/VisualDebugging/Editor/ContextObserver/ContextObserverInspector.cs.meta +11 -0
  244. package/Scripts/VisualDebugging/Editor/ContextObserver.meta +8 -0
  245. package/Scripts/VisualDebugging/Editor/DebugSystems/DebugSystemsBehaviourInspector.cs +709 -0
  246. package/Scripts/VisualDebugging/Editor/DebugSystems/DebugSystemsBehaviourInspector.cs.meta +11 -0
  247. package/Scripts/VisualDebugging/Editor/DebugSystems.meta +8 -0
  248. package/Scripts/VisualDebugging/Editor/EntitasHierarchyIcon.cs +226 -0
  249. package/Scripts/VisualDebugging/Editor/EntitasHierarchyIcon.cs.meta +11 -0
  250. package/Scripts/VisualDebugging/Editor/EntitasRedux.VisualDebugging.Editor.asmdef +21 -0
  251. package/Scripts/VisualDebugging/Editor/EntitasRedux.VisualDebugging.Editor.asmdef.meta +7 -0
  252. package/Scripts/VisualDebugging/Editor/EntitasStats.cs +131 -0
  253. package/Scripts/VisualDebugging/Editor/EntitasStats.cs.meta +11 -0
  254. package/Scripts/VisualDebugging/Editor/EntityLinkInspector.cs +71 -0
  255. package/Scripts/VisualDebugging/Editor/EntityLinkInspector.cs.meta +11 -0
  256. package/Scripts/VisualDebugging/Editor/Graph.cs +234 -0
  257. package/Scripts/VisualDebugging/Editor/Graph.cs.meta +11 -0
  258. package/Scripts/VisualDebugging/Editor/VisualDebugStyles.cs +55 -0
  259. package/Scripts/VisualDebugging/Editor/VisualDebugStyles.cs.meta +11 -0
  260. package/Scripts/VisualDebugging/Editor/VisualDebuggingEntitasExtension.cs +35 -0
  261. package/Scripts/VisualDebugging/Editor/VisualDebuggingEntitasExtension.cs.meta +11 -0
  262. package/Scripts/VisualDebugging/Editor/VisualDebuggingPreferences.cs +188 -0
  263. package/Scripts/VisualDebugging/Editor/VisualDebuggingPreferences.cs.meta +11 -0
  264. package/Scripts/VisualDebugging/Editor.meta +8 -0
  265. package/Scripts/VisualDebugging/EntitasRedux.VisualDebugging.asmdef +18 -0
  266. package/Scripts/VisualDebugging/EntitasRedux.VisualDebugging.asmdef.meta +7 -0
  267. package/Scripts/VisualDebugging/Extensions/GameObjectDestroyExtensions.cs +44 -0
  268. package/Scripts/VisualDebugging/Extensions/GameObjectDestroyExtensions.cs.meta +11 -0
  269. package/Scripts/VisualDebugging/Extensions.meta +8 -0
  270. package/Scripts/VisualDebugging.meta +8 -0
  271. package/Scripts.meta +8 -0
  272. package/package.json +30 -0
  273. package/package.json.meta +7 -0
@@ -0,0 +1,709 @@
1
+ /*
2
+
3
+ MIT License
4
+
5
+ Copyright (c) 2020 Jeff Campbell
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+ */
25
+
26
+ using JCMG.EntitasRedux.Editor;
27
+ using System;
28
+ using System.Collections.Generic;
29
+ using System.Linq;
30
+ using System.Text;
31
+ using UnityEditor;
32
+ using UnityEngine;
33
+
34
+ namespace JCMG.EntitasRedux.VisualDebugging.Editor
35
+ {
36
+ [CustomEditor(typeof(DebugSystemsBehaviour))]
37
+ internal sealed class DebugSystemsBehaviourInspector : UnityEditor.Editor
38
+ {
39
+ private enum SortMethod
40
+ {
41
+ Name,
42
+ NameDescending,
43
+ ExecutionTime,
44
+ ExecutionTimeDescending
45
+ }
46
+
47
+ private int _lastRenderedFrameCount;
48
+
49
+ private Queue<float> _fixedUpdateSystemMonitorData;
50
+ private Queue<float> _updateSystemMonitorData;
51
+ private Queue<float> _lateUpdateSystemMonitorData;
52
+
53
+ private Graph _systemsMonitor;
54
+ private SortMethod _systemSortMethod;
55
+
56
+ private float _threshold;
57
+
58
+ private static bool _showDetails;
59
+ private static bool _showSystemsMonitor = true;
60
+ private static bool _showSystemsList = true;
61
+
62
+ private static bool _showInitializeSystems = true;
63
+ private static bool _showFixedUpdateSystems = true;
64
+ private static bool _showUpdateSystems = true;
65
+ private static bool _showLateUpdateSystems = true;
66
+ private static bool _showReactiveSystems = true;
67
+ private static bool _showCleanupSystems = true;
68
+ private static bool _showTearDownSystems = true;
69
+ private static bool _hideEmptySystems = true;
70
+ private static string _systemNameSearchString = string.Empty;
71
+
72
+ private static readonly StringBuilder STRING_BUILDER;
73
+ private static readonly GUILayoutOption[] LEGEND_LABEL_OPTIONS;
74
+
75
+ private static GUILayoutOption[] _leftLabelGUILayoutOptions;
76
+
77
+ // Data Capture
78
+ private const int SYSTEM_MONITOR_DATA_LENGTH = 60;
79
+
80
+ // Legend
81
+ private const int BOX_HEIGHT_WIDTH = 16;
82
+
83
+ // Top-Level Section Titles
84
+ private const string DETAILS_TITLE = "Overview";
85
+ private const string SYSTEMS_TITLE = "Systems";
86
+ private const string PERFORMANCE_TITLE = "Performance";
87
+
88
+ // Monitor UI
89
+ private const string AVERAGE_PERFORMANCE_TITLE = "Average System Performance";
90
+ private const string GRAPH_LEGEND = "Legend";
91
+ private const string FIXED_UPDATE_LEGEND = "Fixed Update";
92
+ private const string UPDATE_LEGEND = "Update";
93
+ private const string LATE_UPDATE_LEGEND = "Late Update";
94
+
95
+ // System Section Titles
96
+ private const string INITIALIZE_SYSTEMS_TITLE = "Initialize Systems";
97
+ private const string FIXED_UPDATE_SYSTEMS_TITLE = "Fixed Update Systems";
98
+ private const string UPDATE_SYSTEMS_TITLE = "Update Systems";
99
+ private const string LATE_UPDATE_SYSTEMS_TITLE = "Late Update Systems";
100
+ private const string REACTIVE_SYSTEMS_TITLE = "Reactive Systems";
101
+ private const string CLEANUP_SYSTEMS_TITLE = "Cleanup Systems";
102
+ private const string TEARDOWN_SYSTEMS_TITLE = "TearDown Systems";
103
+
104
+ // Count Labels
105
+ private const string INITIALIZE_SYSTEMS_COUNT_LABEL = "Initialize Systems";
106
+ private const string FIXED_UPDATE_SYSTEMS_COUNT_LABEL = "Fixed Update Systems";
107
+ private const string UPDATE_SYSTEMS_COUNT_LABEL = "Update Systems";
108
+ private const string LATE_UPDATE_SYSTEMS_COUNT_LABEL = "Late Update Systems";
109
+ private const string REACTIVE_SYSTEMS_COUNT_LABEL = "Reactive Systems";
110
+ private const string CLEANUP_SYSTEMS_COUNT_LABEL = "Cleanup Systems";
111
+ private const string TEARDOWN_SYSTEMS_COUNT_LABEL = "TearDown Systems";
112
+ private const string TOTAL_SYSTEMS_COUNT_LABEL = "Total Systems";
113
+
114
+ // Duration Labels
115
+ private const string DURATION_TIME_FORMAT = "{0,10:###0.00}";
116
+ private const string FIXED_UPDATE_DURATION_LABEL = "Fixed Update Duration";
117
+ private const string UPDATE_DURATION_LABEL = "Update Duration";
118
+ private const string LATE_UPDATE_DURATION_LABEL = "Late Update Duration";
119
+ private const string REACTIVE_DURATION_LABEL = "Reactive Duration";
120
+ private const string CLEANUP_DURATION_LABEL = "Cleanup Duration";
121
+
122
+ // Profiling Controls
123
+ private const string HIDE_EMPTY_SYSTEMS_LABEL = "Hide Empty Systems";
124
+ private const string THRESHOLD_SLIDER_LABEL = "Threshold Average in ms";
125
+ private const string RESET_AVERAGE_DURATION_LABEL = "Reset Average Interval";
126
+ private const string RESET_AVERAGE_NOW_LABEL = "Reset Average Now";
127
+
128
+ // Help Boxes
129
+ private const string PERFORMANCE_DESCRIPTION = "All performance statistics are meausured in milliseconds (ms).";
130
+
131
+ private const string SYSTEMS_DESCRIPTION = "These are all systems running as a part of this Feature. Toggles " +
132
+ "are available to selectively filter which systems are running.";
133
+
134
+ static DebugSystemsBehaviourInspector()
135
+ {
136
+ LEGEND_LABEL_OPTIONS = new[]
137
+ {
138
+ GUILayout.Width(BOX_HEIGHT_WIDTH),
139
+ GUILayout.Height(BOX_HEIGHT_WIDTH),
140
+ };
141
+ STRING_BUILDER = new StringBuilder(200);
142
+ }
143
+
144
+ private void OnEnable()
145
+ {
146
+ if (_leftLabelGUILayoutOptions == null)
147
+ {
148
+ _leftLabelGUILayoutOptions = new []
149
+ {
150
+ GUILayout.Width(150f)
151
+ };
152
+ }
153
+ }
154
+
155
+ public override void OnInspectorGUI()
156
+ {
157
+ if (_systemsMonitor == null)
158
+ {
159
+ _systemsMonitor = new Graph(SYSTEM_MONITOR_DATA_LENGTH);
160
+
161
+ _fixedUpdateSystemMonitorData = new Queue<float>(new float[SYSTEM_MONITOR_DATA_LENGTH]);
162
+ _updateSystemMonitorData = new Queue<float>(new float[SYSTEM_MONITOR_DATA_LENGTH]);
163
+ _lateUpdateSystemMonitorData = new Queue<float>(new float[SYSTEM_MONITOR_DATA_LENGTH]);
164
+ }
165
+
166
+ var debugSystemsBehaviour = (DebugSystemsBehaviour)target;
167
+ var systems = debugSystemsBehaviour.Systems;
168
+
169
+ EditorGUILayout.HelpBox(PERFORMANCE_DESCRIPTION, MessageType.Info);
170
+
171
+ EditorGUILayout.Space();
172
+ DrawSystemsOverview(systems);
173
+
174
+ EditorGUILayout.Space();
175
+ DrawSystemsMonitor(systems);
176
+
177
+ EditorGUILayout.Space();
178
+ DrawSystemList(systems);
179
+
180
+ EditorGUILayout.Space();
181
+
182
+ EditorUtility.SetDirty(target);
183
+ }
184
+
185
+ private static void DrawSystemsOverview(DebugSystems systems)
186
+ {
187
+ _showDetails = EditorGUILayoutTools.DrawSectionHeaderToggle(DETAILS_TITLE, _showDetails);
188
+ if (_showDetails)
189
+ {
190
+ using (new EditorGUILayout.VerticalScope(EntitasReduxStyles.SectionContent))
191
+ {
192
+ EditorGUILayout.LabelField(INITIALIZE_SYSTEMS_COUNT_LABEL, systems.TotalInitializeSystemsCount.ToString());
193
+ EditorGUILayout.LabelField(FIXED_UPDATE_SYSTEMS_COUNT_LABEL, systems.TotalFixedUpdateSystemsCount.ToString());
194
+ EditorGUILayout.LabelField(UPDATE_SYSTEMS_COUNT_LABEL, systems.TotalUpdateSystemsCount.ToString());
195
+ EditorGUILayout.LabelField(LATE_UPDATE_SYSTEMS_COUNT_LABEL, systems.TotalLateUpdateSystemsCount.ToString());
196
+ EditorGUILayout.LabelField(REACTIVE_SYSTEMS_COUNT_LABEL, systems.TotalReactiveSystemsCount.ToString());
197
+ EditorGUILayout.LabelField(CLEANUP_SYSTEMS_COUNT_LABEL, systems.TotalCleanupSystemsCount.ToString());
198
+ EditorGUILayout.LabelField(TEARDOWN_SYSTEMS_COUNT_LABEL, systems.TotalTearDownSystemsCount.ToString());
199
+ EditorGUILayout.LabelField(TOTAL_SYSTEMS_COUNT_LABEL, systems.TotalSystemsCount.ToString());
200
+ }
201
+ }
202
+ }
203
+
204
+ private void DrawSystemsMonitor(DebugSystems systems)
205
+ {
206
+ _showSystemsMonitor = EditorGUILayoutTools.DrawSectionHeaderToggle(PERFORMANCE_TITLE, _showSystemsMonitor);
207
+ if (_showSystemsMonitor)
208
+ {
209
+ using (new EditorGUILayout.VerticalScope(VisualDebugStyles.SectionContent))
210
+ {
211
+ // Draw Average Performance Stats
212
+ using (new EditorGUILayout.VerticalScope())
213
+ {
214
+ EditorGUILayout.LabelField(AVERAGE_PERFORMANCE_TITLE, EditorStyles.boldLabel);
215
+
216
+ DrawDurationLabel(FIXED_UPDATE_DURATION_LABEL, systems.AverageFixedUpdateDuration);
217
+ DrawDurationLabel(UPDATE_DURATION_LABEL, systems.AverageUpdateDuration);
218
+ DrawDurationLabel(LATE_UPDATE_DURATION_LABEL, systems.AverageLateUpdateDuration);
219
+ DrawDurationLabel(REACTIVE_DURATION_LABEL, systems.AverageReactiveDuration);
220
+ DrawDurationLabel(CLEANUP_DURATION_LABEL, systems.AverageCleanupDuration);
221
+ }
222
+
223
+ // Draw Legend
224
+ using (var legendScope = new EditorGUILayout.VerticalScope())
225
+ {
226
+ using (new EditorGUILayout.HorizontalScope())
227
+ {
228
+ GUILayout.FlexibleSpace();
229
+ EditorGUILayout.LabelField(GRAPH_LEGEND, EditorStyles.boldLabel, GUILayout.Width(60f));
230
+ GUILayout.FlexibleSpace();
231
+ }
232
+
233
+ GUILayout.Space(5);
234
+
235
+ using (new EditorGUILayout.HorizontalScope())
236
+ {
237
+ DrawLegendLabel(FIXED_UPDATE_LEGEND, VisualDebuggingPreferences.FixedUpdateColor);
238
+ GUILayout.FlexibleSpace();
239
+
240
+ DrawLegendLabel(UPDATE_LEGEND, VisualDebuggingPreferences.UpdateColor);
241
+ GUILayout.FlexibleSpace();
242
+
243
+ DrawLegendLabel(LATE_UPDATE_LEGEND, VisualDebuggingPreferences.LateUpdateColor);
244
+ }
245
+ }
246
+
247
+ EditorGUILayout.Space(5);
248
+
249
+ // Update Graph
250
+ if (!EditorApplication.isPaused)
251
+ {
252
+ AddSystemDurations(systems);
253
+ }
254
+
255
+ // Draw Graph
256
+ const float GRAPH_HEIGHT = 100f;
257
+ _systemsMonitor.Draw(
258
+ new[]
259
+ {
260
+ _fixedUpdateSystemMonitorData.ToArray(),
261
+ _updateSystemMonitorData.ToArray(),
262
+ _lateUpdateSystemMonitorData.ToArray()
263
+ },
264
+ Screen.width,
265
+ GRAPH_HEIGHT,
266
+ new[]
267
+ {
268
+ VisualDebuggingPreferences.FixedUpdateColor,
269
+ VisualDebuggingPreferences.UpdateColor,
270
+ VisualDebuggingPreferences.LateUpdateColor
271
+ });
272
+ }
273
+ }
274
+ }
275
+
276
+ private void DrawLegendLabel(string label, Color color)
277
+ {
278
+ using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandWidth(false)))
279
+ {
280
+ var newGUIContent = new GUIContent(label);
281
+ var size = EditorStyles.label.CalcSize(newGUIContent);
282
+ EditorGUILayout.LabelField(newGUIContent, GUILayout.Width(size.x));
283
+
284
+ var fixedUpdateLegendRect = GUILayoutUtility.GetRect(
285
+ BOX_HEIGHT_WIDTH,
286
+ BOX_HEIGHT_WIDTH,
287
+ BOX_HEIGHT_WIDTH,
288
+ BOX_HEIGHT_WIDTH,
289
+ LEGEND_LABEL_OPTIONS);
290
+
291
+ EditorGUILayoutTools.DrawRectWithBorder(
292
+ fixedUpdateLegendRect,
293
+ 2f,
294
+ color,
295
+ Color.black);
296
+
297
+ GUILayout.FlexibleSpace();
298
+ }
299
+ }
300
+
301
+ private void DrawDurationLabel(string label, double duration)
302
+ {
303
+ using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandWidth(false)))
304
+ {
305
+ var size = EditorStyles.label.CalcSize(new GUIContent(label));
306
+ EditorGUILayout.LabelField(label, _leftLabelGUILayoutOptions);
307
+
308
+ EditorGUILayout.LabelField(
309
+ string.Format(DURATION_TIME_FORMAT, duration),
310
+ //VisualDebugStyles.RightAlignGUIStyle,
311
+ GUILayout.MaxWidth(60f));
312
+ }
313
+ }
314
+
315
+ private void DrawSystemList(DebugSystems systems)
316
+ {
317
+ _showSystemsList = EditorGUILayoutTools.DrawSectionHeaderToggle(SYSTEMS_TITLE, _showSystemsList);
318
+ if (_showSystemsList)
319
+ {
320
+ using (new EditorGUILayout.VerticalScope(EntitasReduxStyles.SectionContent))
321
+ {
322
+ EditorGUILayout.HelpBox(SYSTEMS_DESCRIPTION, MessageType.Info);
323
+
324
+ using (new EditorGUILayout.HorizontalScope())
325
+ {
326
+ DebugSystems.avgResetInterval = (AvgResetInterval)EditorGUILayout.EnumPopup(
327
+ RESET_AVERAGE_DURATION_LABEL,
328
+ DebugSystems.avgResetInterval);
329
+
330
+ if (GUILayout.Button(RESET_AVERAGE_NOW_LABEL, EditorStyles.miniButton, GUILayout.Width(150f)))
331
+ {
332
+ systems.ResetDurations();
333
+ }
334
+ }
335
+
336
+ _threshold = EditorGUILayout.Slider(
337
+ THRESHOLD_SLIDER_LABEL,
338
+ _threshold,
339
+ 0f,
340
+ 33f);
341
+
342
+ _hideEmptySystems = EditorGUILayout.Toggle(HIDE_EMPTY_SYSTEMS_LABEL, _hideEmptySystems);
343
+ EditorGUILayout.Space();
344
+
345
+ using (new EditorGUILayout.HorizontalScope())
346
+ {
347
+ _systemSortMethod = (SortMethod)EditorGUILayout.EnumPopup(
348
+ _systemSortMethod,
349
+ EditorStyles.popup,
350
+ GUILayout.Width(150));
351
+ _systemNameSearchString = EditorGUILayoutTools.SearchTextField(_systemNameSearchString);
352
+ }
353
+
354
+ EditorGUILayout.Space();
355
+
356
+ DrawSystemSection(INITIALIZE_SYSTEMS_TITLE, ref _showInitializeSystems, systems, SystemInterfaceFlags.InitializeSystem);
357
+ DrawSystemSection(FIXED_UPDATE_SYSTEMS_TITLE, ref _showFixedUpdateSystems, systems, SystemInterfaceFlags.FixedUpdateSystem);
358
+ DrawSystemSection(UPDATE_SYSTEMS_TITLE, ref _showUpdateSystems, systems, SystemInterfaceFlags.UpdateSystem);
359
+ DrawSystemSection(LATE_UPDATE_SYSTEMS_TITLE, ref _showLateUpdateSystems, systems, SystemInterfaceFlags.LateUpdateSystem);
360
+ DrawSystemSection(REACTIVE_SYSTEMS_TITLE, ref _showReactiveSystems, systems, SystemInterfaceFlags.ReactiveSystem);
361
+ DrawSystemSection(CLEANUP_SYSTEMS_TITLE, ref _showCleanupSystems, systems, SystemInterfaceFlags.CleanupSystem);
362
+ DrawSystemSection(TEARDOWN_SYSTEMS_TITLE, ref _showTearDownSystems, systems, SystemInterfaceFlags.TearDownSystem);
363
+ }
364
+ }
365
+ }
366
+
367
+ private void DrawSystemSection(string header,
368
+ ref bool showSystems,
369
+ DebugSystems systems,
370
+ SystemInterfaceFlags systemInterfaceFlags)
371
+ {
372
+ showSystems = EditorGUILayoutTools.DrawSectionHeaderToggle(header, showSystems);
373
+ if (showSystems && ShouldShowSystems(systems, systemInterfaceFlags))
374
+ {
375
+ using (new EditorGUILayout.VerticalScope(EntitasReduxStyles.SectionContent))
376
+ {
377
+ var systemsDrawn = DrawSystemInfos(systems, systemInterfaceFlags);
378
+ if (systemsDrawn == 0)
379
+ {
380
+ EditorGUILayout.LabelField(string.Empty);
381
+ }
382
+ }
383
+ }
384
+ }
385
+
386
+ private int DrawSystemInfos(DebugSystems systems, SystemInterfaceFlags type)
387
+ {
388
+ IEnumerable<SystemInfo> systemInfos = null;
389
+
390
+ switch (type)
391
+ {
392
+ case SystemInterfaceFlags.InitializeSystem:
393
+ systemInfos = systems.InitializeSystemInfos
394
+ .Where(systemInfo => systemInfo.InitializationDuration >= _threshold);
395
+ break;
396
+ case SystemInterfaceFlags.FixedUpdateSystem:
397
+ systemInfos = systems.FixedUpdateSystemInfos
398
+ .Where(systemInfo => systemInfo.AverageFixedUpdateDuration >= _threshold);
399
+ break;
400
+ case SystemInterfaceFlags.UpdateSystem:
401
+ systemInfos = systems.UpdateSystemInfos
402
+ .Where(systemInfo => systemInfo.AverageUpdateDuration >= _threshold);
403
+ break;
404
+ case SystemInterfaceFlags.LateUpdateSystem:
405
+ systemInfos = systems.LateUpdateSystemInfos
406
+ .Where(systemInfo => systemInfo.AverageLateUpdateDuration >= _threshold);
407
+ break;
408
+ case SystemInterfaceFlags.ReactiveSystem:
409
+ systemInfos = systems.ReactiveSystemInfos
410
+ .Where(systemInfo => systemInfo.AverageReactiveDuration >= _threshold);
411
+ break;
412
+ case SystemInterfaceFlags.CleanupSystem:
413
+ systemInfos = systems.CleanupSystemInfos
414
+ .Where(systemInfo => systemInfo.CleanupDuration >= _threshold);
415
+ break;
416
+ case SystemInterfaceFlags.TearDownSystem:
417
+ systemInfos = systems.TearDownSystemInfos
418
+ .Where(systemInfo => systemInfo.TeardownDuration >= _threshold);
419
+ break;
420
+ default:
421
+ throw new ArgumentOutOfRangeException(nameof(type), type, null);
422
+ }
423
+
424
+ systemInfos = GetSortedSystemInfos(systemInfos, _systemSortMethod);
425
+
426
+ var systemsDrawn = 0;
427
+ foreach (var systemInfo in systemInfos)
428
+ {
429
+ if (systemInfo.System is DebugSystems debugSystems)
430
+ {
431
+ if (!ShouldShowSystems(debugSystems, type))
432
+ {
433
+ continue;
434
+ }
435
+ }
436
+
437
+ if (EditorGUILayoutTools.MatchesSearchString(systemInfo.SystemName.ToLower(), _systemNameSearchString.ToLower()))
438
+ {
439
+ using (new EditorGUILayout.HorizontalScope())
440
+ {
441
+ var indent = EditorGUI.indentLevel;
442
+ EditorGUI.indentLevel = 0;
443
+
444
+ var wasActive = systemInfo.isActive;
445
+ var areParentsActive = systemInfo.AreAllParentsActive;
446
+ if (areParentsActive)
447
+ {
448
+ systemInfo.isActive = EditorGUILayout.Toggle(systemInfo.isActive, GUILayout.Width(20));
449
+ }
450
+ else
451
+ {
452
+ using (new EditorGUI.DisabledScope(true))
453
+ {
454
+ EditorGUILayout.Toggle(false, GUILayout.Width(20));
455
+ }
456
+ }
457
+
458
+ EditorGUI.indentLevel = indent;
459
+
460
+ if (systemInfo.isActive != wasActive)
461
+ {
462
+ if (systemInfo.System is IReactiveSystem reactiveSystem)
463
+ {
464
+ if (systemInfo.isActive)
465
+ {
466
+ reactiveSystem.Activate();
467
+ }
468
+ else
469
+ {
470
+ reactiveSystem.Deactivate();
471
+ }
472
+ }
473
+ }
474
+
475
+ using (new EditorGUI.DisabledScope(!systemInfo.isActive || !areParentsActive))
476
+ {
477
+ var guiStyle = GetSystemStyle(systemInfo, type);
478
+
479
+ switch (type)
480
+ {
481
+ case SystemInterfaceFlags.InitializeSystem:
482
+ DrawSimpleSystemInfoPerformance(
483
+ systemInfo.SystemName,
484
+ systemInfo.InitializationDuration,
485
+ guiStyle);
486
+ break;
487
+ case SystemInterfaceFlags.FixedUpdateSystem:
488
+ DrawDetailedSystemInfoPerformance(
489
+ systemInfo.SystemName,
490
+ systemInfo.AverageFixedUpdateDuration,
491
+ systemInfo.MinFixedUpdateDuration,
492
+ systemInfo.MaxFixedUpdateDuration,
493
+ guiStyle);
494
+ break;
495
+ case SystemInterfaceFlags.UpdateSystem:
496
+ DrawDetailedSystemInfoPerformance(
497
+ systemInfo.SystemName,
498
+ systemInfo.AverageUpdateDuration,
499
+ systemInfo.MinUpdateDuration,
500
+ systemInfo.MaxUpdateDuration,
501
+ guiStyle);
502
+ break;
503
+ case SystemInterfaceFlags.LateUpdateSystem:
504
+ DrawDetailedSystemInfoPerformance(
505
+ systemInfo.SystemName,
506
+ systemInfo.AverageLateUpdateDuration,
507
+ systemInfo.MinLateUpdateDuration,
508
+ systemInfo.MaxLateUpdateDuration,
509
+ guiStyle);
510
+ break;
511
+ case SystemInterfaceFlags.ReactiveSystem:
512
+ DrawDetailedSystemInfoPerformance(
513
+ systemInfo.SystemName,
514
+ systemInfo.AverageReactiveDuration,
515
+ systemInfo.MinReactiveDuration,
516
+ systemInfo.MaxReactiveDuration,
517
+ guiStyle);
518
+ break;
519
+ case SystemInterfaceFlags.CleanupSystem:
520
+ DrawDetailedSystemInfoPerformance(
521
+ systemInfo.SystemName,
522
+ systemInfo.AverageCleanupDuration,
523
+ systemInfo.MinCleanupDuration,
524
+ systemInfo.MaxCleanupDuration,
525
+ guiStyle);
526
+ break;
527
+ case SystemInterfaceFlags.TearDownSystem:
528
+ DrawSimpleSystemInfoPerformance(
529
+ systemInfo.SystemName,
530
+ systemInfo.TeardownDuration,
531
+ guiStyle);
532
+ break;
533
+ default:
534
+ throw new ArgumentOutOfRangeException(nameof(type), type, null);
535
+ }
536
+ }
537
+ }
538
+
539
+ systemsDrawn += 1;
540
+ }
541
+
542
+ if (systemInfo.System is DebugSystems debugSystem)
543
+ {
544
+ var indent = EditorGUI.indentLevel;
545
+ EditorGUI.indentLevel += 1;
546
+ systemsDrawn += DrawSystemInfos(debugSystem, type);
547
+ EditorGUI.indentLevel = indent;
548
+ }
549
+ }
550
+
551
+ return systemsDrawn;
552
+ }
553
+
554
+ private void DrawSimpleSystemInfoPerformance(
555
+ string systemName,
556
+ double duration,
557
+ GUIStyle style)
558
+ {
559
+ using (new EditorGUILayout.HorizontalScope())
560
+ {
561
+ EditorGUILayout.LabelField(systemName, style);
562
+ EditorGUILayout.LabelField(string.Format(DURATION_TIME_FORMAT, duration), style);
563
+ GUILayout.FlexibleSpace();
564
+ }
565
+ }
566
+
567
+ private void DrawDetailedSystemInfoPerformance(
568
+ string systemName,
569
+ double averageDuration,
570
+ double minDuration,
571
+ double maxDuration,
572
+ GUIStyle style)
573
+ {
574
+ const string AVERAGE_FORMAT = "Avg {0:00.000}";
575
+ const string MIN_FORMAT = "▼ {0:00.000}";
576
+ const string MAX_FORMAT = "▲ {0:00.000}";
577
+
578
+ STRING_BUILDER.Clear();
579
+ STRING_BUILDER.Append(string.Format(AVERAGE_FORMAT, averageDuration).PadRight(14));
580
+ STRING_BUILDER.Append(string.Format(MIN_FORMAT, minDuration).PadRight(12));
581
+ STRING_BUILDER.Append(string.Format(MAX_FORMAT, maxDuration));
582
+
583
+ using (new EditorGUILayout.HorizontalScope())
584
+ {
585
+ EditorGUILayout.LabelField(systemName, STRING_BUILDER.ToString(), style);
586
+ }
587
+ }
588
+
589
+ private static IEnumerable<SystemInfo> GetSortedSystemInfos(IEnumerable<SystemInfo> systemInfos, SortMethod sortMethod)
590
+ {
591
+ switch (sortMethod)
592
+ {
593
+ case SortMethod.Name:
594
+ return systemInfos.OrderBy(systemInfo => systemInfo.SystemName);
595
+ case SortMethod.NameDescending:
596
+ return systemInfos.OrderByDescending(systemInfo => systemInfo.SystemName);
597
+ case SortMethod.ExecutionTime:
598
+ return systemInfos.OrderBy(systemInfo => systemInfo.AverageUpdateDuration);
599
+ case SortMethod.ExecutionTimeDescending:
600
+ return systemInfos.OrderByDescending(systemInfo => systemInfo.AverageUpdateDuration);
601
+ default:
602
+ return systemInfos;
603
+ }
604
+ }
605
+
606
+ private static bool ShouldShowSystems(DebugSystems systems, SystemInterfaceFlags type)
607
+ {
608
+ if (!_hideEmptySystems)
609
+ {
610
+ return true;
611
+ }
612
+
613
+ switch (type)
614
+ {
615
+ case SystemInterfaceFlags.InitializeSystem:
616
+ return systems.TotalInitializeSystemsCount > 0;
617
+ case SystemInterfaceFlags.FixedUpdateSystem:
618
+ return systems.TotalFixedUpdateSystemsCount > 0;
619
+ case SystemInterfaceFlags.UpdateSystem:
620
+ return systems.TotalUpdateSystemsCount > 0;
621
+ case SystemInterfaceFlags.LateUpdateSystem:
622
+ return systems.TotalLateUpdateSystemsCount > 0;
623
+ case SystemInterfaceFlags.ReactiveSystem:
624
+ return systems.TotalReactiveSystemsCount > 0;
625
+ case SystemInterfaceFlags.CleanupSystem:
626
+ return systems.TotalCleanupSystemsCount > 0;
627
+ case SystemInterfaceFlags.TearDownSystem:
628
+ return systems.TotalTearDownSystemsCount > 0;
629
+ default:
630
+ return true;
631
+ }
632
+ }
633
+
634
+ private GUIStyle GetSystemStyle(SystemInfo systemInfo, SystemInterfaceFlags systemFlag)
635
+ {
636
+ var style = new GUIStyle(GUI.skin.label);
637
+ var color = systemInfo.IsReactiveSystems && EditorGUIUtility.isProSkin
638
+ ? Color.white
639
+ : style.normal.textColor;
640
+
641
+ if (systemFlag == SystemInterfaceFlags.FixedUpdateSystem &&
642
+ systemInfo.AverageFixedUpdateDuration >= VisualDebuggingPreferences.SystemWarningThreshold)
643
+ {
644
+ color = Color.red;
645
+ }
646
+
647
+ if (systemFlag == SystemInterfaceFlags.UpdateSystem &&
648
+ systemInfo.AverageUpdateDuration >= VisualDebuggingPreferences.SystemWarningThreshold)
649
+ {
650
+ color = Color.red;
651
+ }
652
+
653
+ if (systemFlag == SystemInterfaceFlags.LateUpdateSystem &&
654
+ systemInfo.AverageLateUpdateDuration >= VisualDebuggingPreferences.SystemWarningThreshold)
655
+ {
656
+ color = Color.red;
657
+ }
658
+
659
+ if (systemFlag == SystemInterfaceFlags.ReactiveSystem &&
660
+ systemInfo.AverageReactiveDuration >= VisualDebuggingPreferences.SystemWarningThreshold)
661
+ {
662
+ color = Color.red;
663
+ }
664
+
665
+ if (systemFlag == SystemInterfaceFlags.CleanupSystem &&
666
+ systemInfo.AverageCleanupDuration >= VisualDebuggingPreferences.SystemWarningThreshold)
667
+ {
668
+ color = Color.red;
669
+ }
670
+
671
+ style.normal.textColor = color;
672
+
673
+ return style;
674
+ }
675
+
676
+ private void AddSystemDurations(DebugSystems systems)
677
+ {
678
+ // OnInspectorGUI is called twice per frame - only add duration once
679
+ if (Time.renderedFrameCount != _lastRenderedFrameCount)
680
+ {
681
+ _lastRenderedFrameCount = Time.renderedFrameCount;
682
+
683
+ // Execute System
684
+ if (_updateSystemMonitorData.Count >= SYSTEM_MONITOR_DATA_LENGTH)
685
+ {
686
+ _updateSystemMonitorData.Dequeue();
687
+ }
688
+
689
+ _updateSystemMonitorData.Enqueue((float)systems.UpdateDuration);
690
+
691
+ // Fixed Update System
692
+ if (_fixedUpdateSystemMonitorData.Count >= SYSTEM_MONITOR_DATA_LENGTH)
693
+ {
694
+ _fixedUpdateSystemMonitorData.Dequeue();
695
+ }
696
+
697
+ _fixedUpdateSystemMonitorData.Enqueue((float)systems.FixedUpdateDuration);
698
+
699
+ // Late Update System
700
+ if (_lateUpdateSystemMonitorData.Count >= SYSTEM_MONITOR_DATA_LENGTH)
701
+ {
702
+ _lateUpdateSystemMonitorData.Dequeue();
703
+ }
704
+
705
+ _lateUpdateSystemMonitorData.Enqueue((float)systems.LateUpdateDuration + +(float)systems.CleanupDuration);
706
+ }
707
+ }
708
+ }
709
+ }