com.wallstop-studios.dxmessaging 2.2.0 → 3.1.0

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 (270) hide show
  1. package/CHANGELOG.md +315 -67
  2. package/CHANGELOG.md.meta +7 -7
  3. package/Editor/Analyzers/BaseCallIlInspector.cs +277 -0
  4. package/Editor/Analyzers/BaseCallIlInspector.cs.meta +11 -0
  5. package/Editor/Analyzers/BaseCallLogMessageParser.cs +295 -0
  6. package/Editor/Analyzers/BaseCallLogMessageParser.cs.meta +11 -0
  7. package/Editor/Analyzers/BaseCallReportAggregator.cs +308 -0
  8. package/Editor/Analyzers/BaseCallReportAggregator.cs.meta +11 -0
  9. package/Editor/Analyzers/BaseCallTypeScanner.cs +110 -0
  10. package/Editor/Analyzers/BaseCallTypeScanner.cs.meta +11 -0
  11. package/Editor/Analyzers/BaseCallTypeScannerCore.cs +562 -0
  12. package/Editor/Analyzers/BaseCallTypeScannerCore.cs.meta +11 -0
  13. package/Editor/Analyzers/DxMessagingConsoleHarvester.cs +1129 -0
  14. package/Editor/Analyzers/DxMessagingConsoleHarvester.cs.meta +11 -0
  15. package/Editor/Analyzers/Microsoft.CodeAnalysis.CSharp.dll.meta +44 -44
  16. package/Editor/Analyzers/Microsoft.CodeAnalysis.dll.meta +44 -44
  17. package/Editor/Analyzers/System.Collections.Immutable.dll.meta +44 -44
  18. package/Editor/Analyzers/System.Reflection.Metadata.dll.meta +44 -44
  19. package/Editor/Analyzers/System.Runtime.CompilerServices.Unsafe.dll.meta +44 -44
  20. package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll +0 -0
  21. package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll.meta +46 -0
  22. package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll +0 -0
  23. package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll.meta +72 -72
  24. package/Editor/Analyzers.meta +8 -8
  25. package/Editor/AssemblyInfo.cs.meta +11 -3
  26. package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs +81 -0
  27. package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs.meta +11 -0
  28. package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs +429 -0
  29. package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs.meta +11 -0
  30. package/Editor/CustomEditors/MessagingComponentEditor.cs +1 -1
  31. package/Editor/CustomEditors/MessagingComponentEditor.cs.meta +11 -3
  32. package/Editor/CustomEditors.meta +2 -2
  33. package/Editor/DxMessagingEditorIdle.cs +62 -0
  34. package/Editor/DxMessagingEditorIdle.cs.meta +11 -0
  35. package/Editor/DxMessagingEditorInitializer.cs +112 -15
  36. package/Editor/DxMessagingEditorInitializer.cs.meta +11 -3
  37. package/Editor/DxMessagingEditorLog.cs +32 -0
  38. package/Editor/DxMessagingEditorLog.cs.meta +11 -0
  39. package/Editor/DxMessagingMenu.cs.meta +11 -11
  40. package/Editor/DxMessagingSceneBuildProcessor.cs.meta +11 -11
  41. package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs +313 -0
  42. package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs.meta +11 -0
  43. package/Editor/Settings/DxMessagingSettings.cs +261 -11
  44. package/Editor/Settings/DxMessagingSettings.cs.meta +11 -3
  45. package/Editor/Settings/DxMessagingSettingsProvider.cs +50 -33
  46. package/Editor/Settings/DxMessagingSettingsProvider.cs.meta +11 -3
  47. package/Editor/Settings.meta +2 -2
  48. package/Editor/SetupCscRsp.cs +406 -39
  49. package/Editor/SetupCscRsp.cs.meta +11 -3
  50. package/Editor/Testing/MessagingComponentEditorHarness.cs +2 -2
  51. package/Editor/Testing/MessagingComponentEditorHarness.cs.meta +11 -3
  52. package/Editor/Testing.meta +3 -3
  53. package/Editor/WallstopStudios.DxMessaging.Editor.asmdef +14 -14
  54. package/Editor/WallstopStudios.DxMessaging.Editor.asmdef.meta +7 -7
  55. package/Editor.meta +8 -8
  56. package/LICENSE.md +9 -9
  57. package/LICENSE.md.meta +7 -7
  58. package/README.md +940 -900
  59. package/README.md.meta +7 -7
  60. package/Runtime/AssemblyInfo.cs +4 -0
  61. package/Runtime/AssemblyInfo.cs.meta +11 -3
  62. package/Runtime/Core/Attributes/DxAutoConstructorAttribute.cs.meta +11 -3
  63. package/Runtime/Core/Attributes/DxBroadcastMessageAttribute.cs.meta +11 -3
  64. package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs +26 -0
  65. package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs.meta +11 -0
  66. package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs +2 -4
  67. package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs.meta +11 -3
  68. package/Runtime/Core/Attributes/DxTargetedMessageAttribute.cs.meta +11 -3
  69. package/Runtime/Core/Attributes/DxUntargetedMessageAttribute.cs.meta +11 -3
  70. package/Runtime/Core/Attributes/Il2CppSetOptionAttribute.cs +56 -0
  71. package/Runtime/Core/Attributes/Il2CppSetOptionAttribute.cs.meta +11 -0
  72. package/Runtime/Core/Attributes.meta +2 -2
  73. package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs +195 -0
  74. package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs.meta +11 -0
  75. package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs +179 -0
  76. package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs.meta +11 -0
  77. package/Runtime/Core/Configuration.meta +9 -0
  78. package/Runtime/Core/DataStructure/CyclicBuffer.cs +46 -28
  79. package/Runtime/Core/DataStructure/CyclicBuffer.cs.meta +11 -3
  80. package/Runtime/Core/DataStructure.meta +2 -2
  81. package/Runtime/Core/Diagnostics/MessageEmissionData.cs.meta +11 -3
  82. package/Runtime/Core/Diagnostics/MessageRegistrationData.cs.meta +11 -3
  83. package/Runtime/Core/Diagnostics/MessageRegistrationType.cs.meta +11 -3
  84. package/Runtime/Core/Diagnostics.meta +2 -2
  85. package/Runtime/Core/DxMessagingStaticState.cs +19 -0
  86. package/Runtime/Core/DxMessagingStaticState.cs.meta +11 -11
  87. package/Runtime/Core/Extensions/EnumExtensions.cs +6 -5
  88. package/Runtime/Core/Extensions/EnumExtensions.cs.meta +11 -3
  89. package/Runtime/Core/Extensions/IListExtensions.cs.meta +11 -3
  90. package/Runtime/Core/Extensions/MessageBusExtensions.cs.meta +12 -12
  91. package/Runtime/Core/Extensions/MessageExtensions.cs +0 -60
  92. package/Runtime/Core/Extensions/MessageExtensions.cs.meta +11 -11
  93. package/Runtime/Core/Extensions.meta +8 -8
  94. package/Runtime/Core/Helper/MessageCache.cs +32 -0
  95. package/Runtime/Core/Helper/MessageCache.cs.meta +11 -3
  96. package/Runtime/Core/Helper/MessageHelperIndexer.cs.meta +11 -3
  97. package/Runtime/Core/Helper.meta +2 -2
  98. package/Runtime/Core/IMessage.cs +3 -3
  99. package/Runtime/Core/IMessage.cs.meta +11 -11
  100. package/Runtime/Core/InstanceId.cs +25 -1
  101. package/Runtime/Core/InstanceId.cs.meta +11 -11
  102. package/Runtime/Core/Internal/DxUnsafe.cs +60 -0
  103. package/Runtime/Core/Internal/DxUnsafe.cs.meta +11 -0
  104. package/Runtime/Core/Internal/FlatDispatch.cs +198 -0
  105. package/Runtime/Core/Internal/FlatDispatch.cs.meta +11 -0
  106. package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs +38 -0
  107. package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs.meta +11 -0
  108. package/Runtime/Core/Internal/TypedSlotIndex.cs +81 -0
  109. package/Runtime/Core/Internal/TypedSlotIndex.cs.meta +11 -0
  110. package/Runtime/Core/Internal/TypedSlots.cs +597 -0
  111. package/Runtime/Core/Internal/TypedSlots.cs.meta +11 -0
  112. package/Runtime/Core/Internal.meta +9 -0
  113. package/Runtime/Core/MessageBus/DiagnosticsTarget.cs.meta +11 -11
  114. package/Runtime/Core/MessageBus/GlobalMessageBusProvider.cs.meta +11 -11
  115. package/Runtime/Core/MessageBus/IMessageBus.cs +189 -15
  116. package/Runtime/Core/MessageBus/IMessageBus.cs.meta +11 -11
  117. package/Runtime/Core/MessageBus/IMessageBusProvider.cs.meta +11 -11
  118. package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs +1 -0
  119. package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs.meta +11 -11
  120. package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs +16 -0
  121. package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs.meta +11 -0
  122. package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs +40 -0
  123. package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs.meta +11 -0
  124. package/Runtime/Core/MessageBus/Internal/BusSlots.cs +719 -0
  125. package/Runtime/Core/MessageBus/Internal/BusSlots.cs.meta +11 -0
  126. package/Runtime/Core/MessageBus/Internal/DispatchKind.cs +38 -0
  127. package/Runtime/Core/MessageBus/Internal/DispatchKind.cs.meta +11 -0
  128. package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs +20 -0
  129. package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs.meta +11 -0
  130. package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs +28 -0
  131. package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs.meta +11 -0
  132. package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs +48 -0
  133. package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs.meta +11 -0
  134. package/Runtime/Core/MessageBus/Internal/ISweepable.cs +15 -0
  135. package/Runtime/Core/MessageBus/Internal/ISweepable.cs.meta +11 -0
  136. package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs +222 -0
  137. package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs.meta +11 -0
  138. package/Runtime/Core/MessageBus/Internal/SlotKey.cs +192 -0
  139. package/Runtime/Core/MessageBus/Internal/SlotKey.cs.meta +11 -0
  140. package/Runtime/Core/MessageBus/Internal.meta +9 -0
  141. package/Runtime/Core/MessageBus/MessageBus.cs +5366 -3838
  142. package/Runtime/Core/MessageBus/MessageBus.cs.meta +11 -11
  143. package/Runtime/Core/MessageBus/MessageBusRebindMode.cs.meta +11 -11
  144. package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs +187 -14
  145. package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs.meta +11 -11
  146. package/Runtime/Core/MessageBus/MessagingRegistration.cs.meta +11 -11
  147. package/Runtime/Core/MessageBus/RegistrationLog.cs.meta +11 -11
  148. package/Runtime/Core/MessageBus.meta +8 -8
  149. package/Runtime/Core/MessageHandler.cs +2399 -1042
  150. package/Runtime/Core/MessageHandler.cs.meta +11 -11
  151. package/Runtime/Core/MessageRegistrationHandle.cs.meta +11 -11
  152. package/Runtime/Core/MessageRegistrationToken.cs +429 -44
  153. package/Runtime/Core/MessageRegistrationToken.cs.meta +11 -11
  154. package/Runtime/Core/Messages/GlobalStringMessage.cs.meta +11 -3
  155. package/Runtime/Core/Messages/IBroadcastMessage.cs.meta +11 -11
  156. package/Runtime/Core/Messages/ITargetedMessage.cs.meta +11 -11
  157. package/Runtime/Core/Messages/IUntargetedMessage.cs.meta +11 -11
  158. package/Runtime/Core/Messages/ReflexiveMessage.cs.meta +11 -3
  159. package/Runtime/Core/Messages/SourcedStringMessage.cs.meta +11 -11
  160. package/Runtime/Core/Messages/StringMessage.cs.meta +11 -3
  161. package/Runtime/Core/Messages.meta +8 -8
  162. package/Runtime/Core/MessagingDebug.cs.meta +11 -11
  163. package/Runtime/Core/Pooling/CollectionPool.cs +266 -0
  164. package/Runtime/Core/Pooling/CollectionPool.cs.meta +11 -0
  165. package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs +30 -0
  166. package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs.meta +11 -0
  167. package/Runtime/Core/Pooling/DxPools.cs +157 -0
  168. package/Runtime/Core/Pooling/DxPools.cs.meta +11 -0
  169. package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs +106 -0
  170. package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs.meta +11 -0
  171. package/Runtime/Core/Pooling/IDxMessagingClock.cs +18 -0
  172. package/Runtime/Core/Pooling/IDxMessagingClock.cs.meta +11 -0
  173. package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs +55 -0
  174. package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs.meta +11 -0
  175. package/Runtime/Core/Pooling/StopwatchClock.cs +27 -0
  176. package/Runtime/Core/Pooling/StopwatchClock.cs.meta +11 -0
  177. package/Runtime/Core/Pooling/UnityRealtimeClock.cs +31 -0
  178. package/Runtime/Core/Pooling/UnityRealtimeClock.cs.meta +11 -0
  179. package/Runtime/Core/Pooling.meta +9 -0
  180. package/Runtime/Core.meta +8 -8
  181. package/Runtime/Unity/CurrentGlobalMessageBusProvider.cs.meta +12 -12
  182. package/Runtime/Unity/DxMessagingRuntimeInitializer.cs.meta +11 -11
  183. package/Runtime/Unity/InitialGlobalMessageBusProvider.cs.meta +12 -12
  184. package/Runtime/Unity/Integrations/Reflex/AssemblyInfo.cs.meta +11 -3
  185. package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs +73 -0
  186. package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs.meta +11 -11
  187. package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef +20 -20
  188. package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef.meta +7 -7
  189. package/Runtime/Unity/Integrations/Reflex.meta +8 -8
  190. package/Runtime/Unity/Integrations/VContainer/AssemblyInfo.cs.meta +11 -3
  191. package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs +109 -1
  192. package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs.meta +11 -11
  193. package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef +30 -30
  194. package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef.meta +7 -7
  195. package/Runtime/Unity/Integrations/VContainer.meta +8 -8
  196. package/Runtime/Unity/Integrations/Zenject/AssemblyInfo.cs.meta +11 -3
  197. package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef +30 -30
  198. package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef.meta +7 -7
  199. package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs +79 -1
  200. package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs.meta +11 -11
  201. package/Runtime/Unity/Integrations/Zenject.meta +8 -8
  202. package/Runtime/Unity/Integrations.meta +8 -8
  203. package/Runtime/Unity/MessageAwareComponent.cs +74 -0
  204. package/Runtime/Unity/MessageAwareComponent.cs.meta +11 -11
  205. package/Runtime/Unity/MessageBusProviderHandle.cs.meta +12 -12
  206. package/Runtime/Unity/MessagingComponent.cs +43 -10
  207. package/Runtime/Unity/MessagingComponent.cs.meta +11 -11
  208. package/Runtime/Unity/MessagingComponentInstaller.cs.meta +12 -12
  209. package/Runtime/Unity/ScriptableMessageBusProvider.cs.meta +12 -12
  210. package/Runtime/Unity.meta +8 -8
  211. package/Runtime/WallstopStudios.DxMessaging.asmdef +14 -14
  212. package/Runtime/WallstopStudios.DxMessaging.asmdef.meta +7 -7
  213. package/Runtime.meta +8 -8
  214. package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab +98 -98
  215. package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab.meta +7 -7
  216. package/Samples~/DI/Prefabs.meta +8 -8
  217. package/Samples~/DI/Providers/GlobalMessageBusProvider.asset +14 -14
  218. package/Samples~/DI/Providers/GlobalMessageBusProvider.asset.meta +8 -8
  219. package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset +14 -14
  220. package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset.meta +8 -8
  221. package/Samples~/DI/Providers.meta +8 -8
  222. package/Samples~/DI/README.md +51 -51
  223. package/Samples~/DI/README.md.meta +7 -7
  224. package/Samples~/DI/Reflex/SampleInstaller.cs +7 -0
  225. package/Samples~/DI/Reflex/SampleInstaller.cs.meta +11 -11
  226. package/Samples~/DI/Reflex.meta +8 -8
  227. package/Samples~/DI/VContainer/SampleLifetimeScope.cs +6 -1
  228. package/Samples~/DI/VContainer/SampleLifetimeScope.cs.meta +11 -11
  229. package/Samples~/DI/VContainer.meta +8 -8
  230. package/Samples~/DI/Zenject/SampleInstaller.cs +8 -0
  231. package/Samples~/DI/Zenject/SampleInstaller.cs.meta +11 -11
  232. package/Samples~/DI/Zenject.meta +8 -8
  233. package/Samples~/DI.meta +8 -8
  234. package/Samples~/Mini Combat/Boot.cs.meta +11 -11
  235. package/Samples~/Mini Combat/Enemy.cs.meta +11 -11
  236. package/Samples~/Mini Combat/Messages.cs.meta +11 -11
  237. package/Samples~/Mini Combat/Player.cs.meta +11 -11
  238. package/Samples~/Mini Combat/README.md +324 -323
  239. package/Samples~/Mini Combat/README.md.meta +7 -7
  240. package/Samples~/Mini Combat/UIOverlay.cs.meta +11 -11
  241. package/Samples~/Mini Combat/Walkthrough.md +430 -430
  242. package/Samples~/Mini Combat/Walkthrough.md.meta +7 -7
  243. package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef +13 -13
  244. package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef.meta +7 -7
  245. package/Samples~/Mini Combat.meta +8 -8
  246. package/Samples~/UI Buttons + Inspector/DiagnosticsEnabler.cs.meta +11 -11
  247. package/Samples~/UI Buttons + Inspector/Messages.cs.meta +11 -11
  248. package/Samples~/UI Buttons + Inspector/MessagingObserver.cs.meta +11 -11
  249. package/Samples~/UI Buttons + Inspector/README.md +210 -209
  250. package/Samples~/UI Buttons + Inspector/README.md.meta +7 -7
  251. package/Samples~/UI Buttons + Inspector/UIButtonEmitter.cs.meta +11 -11
  252. package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef +13 -13
  253. package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef.meta +7 -7
  254. package/Samples~/UI Buttons + Inspector.meta +8 -8
  255. package/SourceGenerators/Directory.Build.props +50 -3
  256. package/SourceGenerators/Directory.Build.props.meta +7 -7
  257. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs +96 -63
  258. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs.meta +11 -11
  259. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs +745 -87
  260. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs.meta +11 -3
  261. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj +39 -46
  262. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj.meta +7 -7
  263. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.meta +8 -8
  264. package/SourceGenerators/global.json +7 -0
  265. package/SourceGenerators/global.json.meta +7 -0
  266. package/SourceGenerators.meta +8 -8
  267. package/Third Party Notices.md +3 -3
  268. package/Third Party Notices.md.meta +7 -7
  269. package/package.json +102 -92
  270. package/package.json.meta +7 -7
@@ -50,10 +50,34 @@ namespace DxMessaging.Core
50
50
  #if UNITY_2021_3_OR_NEWER
51
51
  private InstanceId(UnityEngine.Object unityObject)
52
52
  {
53
- _id = unityObject.GetInstanceID();
53
+ _id = StableId(unityObject);
54
54
  Object = unityObject;
55
55
  }
56
56
 
57
+ /// <summary>
58
+ /// Returns the stable per-object integer identity used as the dispatch key.
59
+ /// Unity 6 is migrating object identity to the 64-bit <c>EntityId</c>:
60
+ /// <c>GetInstanceID()</c> is deprecated and becomes a compile error in Unity 6.5,
61
+ /// and successive raw accessors (the <c>EntityId</c>-to-<c>int</c> cast, then
62
+ /// <c>GetRawData()</c>) have each been deprecated in turn. On Unity 6.4+ this reads
63
+ /// the non-deprecated <c>EntityId.ToULong(...)</c> and keeps its low 32 bits --
64
+ /// exactly the integer the legacy <c>GetInstanceID()</c> returned (verified on 6.4
65
+ /// across GameObject/Component/ScriptableObject). Older Unity keeps
66
+ /// <c>GetInstanceID()</c> (valid, warning-only there, never the 6.5 error). The
67
+ /// 32-bit dispatch key is identical either way; only the (non-deprecated) source
68
+ /// differs. The gate is the host-verified 6.4 rather than 6.2 because the exact
69
+ /// accessor that is non-deprecated has shifted across Unity 6 minors.
70
+ /// </summary>
71
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
72
+ internal static int StableId(UnityEngine.Object unityObject)
73
+ {
74
+ #if UNITY_6000_4_OR_NEWER
75
+ return unchecked((int)UnityEngine.EntityId.ToULong(unityObject.GetEntityId()));
76
+ #else
77
+ return unityObject.GetInstanceID();
78
+ #endif
79
+ }
80
+
57
81
  [MethodImpl(MethodImplOptions.AggressiveInlining)]
58
82
  /// <summary>
59
83
  /// Converts a <see cref="UnityEngine.GameObject"/> reference into an <see cref="InstanceId"/>.
@@ -1,11 +1,11 @@
1
- fileFormatVersion: 2
2
- guid: 41b061d3cfb2f244b9806bfda65e3fa3
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
1
+ fileFormatVersion: 2
2
+ guid: 41b061d3cfb2f244b9806bfda65e3fa3
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,60 @@
1
+ namespace DxMessaging.Core.Internal
2
+ {
3
+ using System.Runtime.CompilerServices;
4
+ // Qualified with global:: because this assembly also declares a DxMessaging.Unity
5
+ // namespace; an unqualified "using Unity.Collections..." would bind to
6
+ // DxMessaging.Unity.Collections and fail to resolve.
7
+ using global::Unity.Collections.LowLevel.Unsafe;
8
+
9
+ /// <summary>
10
+ /// Reinterpret-cast helpers used by the hot dispatch path. Each method wraps a Unity
11
+ /// <see cref="UnsafeUtility"/> intrinsic, which resolves in both the Editor and every
12
+ /// player build (Mono and IL2CPP, including the .NET Standard 2.0 profile) without an
13
+ /// external precompiled assembly.
14
+ /// </summary>
15
+ /// <remarks>
16
+ /// These are drop-in replacements for the corresponding
17
+ /// <c>System.Runtime.CompilerServices.Unsafe</c> members. That type is supplied by the
18
+ /// Editor but is absent from player builds, so referencing it compiled in the Editor yet
19
+ /// failed standalone IL2CPP compilation. <see cref="UnsafeUtility"/> ships inside
20
+ /// <c>UnityEngine.CoreModule</c> on every supported platform, so routing through it keeps
21
+ /// the zero-allocation reinterpret behavior while removing the unresolved dependency.
22
+ /// The wrapped intrinsics are pure IL (no internal-call transition), so this indirection
23
+ /// is free once inlined.
24
+ /// </remarks>
25
+ internal static class DxUnsafe
26
+ {
27
+ /// <summary>
28
+ /// Reinterprets a managed reference to <typeparamref name="TFrom"/> as a reference to
29
+ /// <typeparamref name="TTo"/> in place, without copying or boxing. Callers guarantee the
30
+ /// reinterpretation is valid for the concrete runtime layout.
31
+ /// </summary>
32
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
33
+ internal static ref TTo As<TFrom, TTo>(ref TFrom source)
34
+ {
35
+ return ref UnsafeUtility.As<TFrom, TTo>(ref source);
36
+ }
37
+
38
+ /// <summary>
39
+ /// Reinterprets a reference-typed instance as <typeparamref name="TTo"/> without a type
40
+ /// check. Callers guarantee the runtime type, mirroring the prior unchecked
41
+ /// <c>Unsafe.As&lt;T&gt;(object)</c> usage.
42
+ /// </summary>
43
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
44
+ internal static TTo As<TTo>(object value)
45
+ where TTo : class
46
+ {
47
+ return UnsafeUtility.As<object, TTo>(ref value);
48
+ }
49
+
50
+ /// <summary>
51
+ /// Returns the size in bytes of <typeparamref name="T"/>.
52
+ /// </summary>
53
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
54
+ internal static int SizeOf<T>()
55
+ where T : struct
56
+ {
57
+ return UnsafeUtility.SizeOf<T>();
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: ee766f9071484d4296892a84523a9aaa
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,198 @@
1
+ namespace DxMessaging.Core.Internal
2
+ {
3
+ using System;
4
+ using System.Buffers;
5
+ using System.Collections.Generic;
6
+ using DxMessaging.Core;
7
+
8
+ /// <summary>
9
+ /// One fully-resolved dispatch entry for slots whose delegates do NOT
10
+ /// receive the routing context (untargeted handle/post, and the
11
+ /// context-keyed Default-variant targeted/broadcast slots, where the
12
+ /// target/source is the routing key rather than a delegate parameter):
13
+ /// the owning <see cref="MessageHandler"/> (for the single live
14
+ /// <c>active</c> check) plus the final invocable delegate, resolved at
15
+ /// snapshot-build time. Steady-state dispatch over an array of these is
16
+ /// a single field read, one branch, and a direct delegate invocation per
17
+ /// entry - no dispatch link, no generation guard, no per-priority
18
+ /// dictionary lookup, and no type test.
19
+ /// </summary>
20
+ /// <typeparam name="TMessage">Concrete message type of the dispatch slot.</typeparam>
21
+ internal readonly struct FlatDispatchEntry<TMessage>
22
+ where TMessage : IMessage
23
+ {
24
+ public FlatDispatchEntry(
25
+ MessageHandler handler,
26
+ MessageHandler.FastHandler<TMessage> invoker
27
+ )
28
+ {
29
+ this.handler = handler;
30
+ this.invoker = invoker;
31
+ }
32
+
33
+ public readonly MessageHandler handler;
34
+ public readonly MessageHandler.FastHandler<TMessage> invoker;
35
+ }
36
+
37
+ /// <summary>
38
+ /// One fully-resolved dispatch entry for the WithoutContext
39
+ /// targeted/broadcast slots, whose delegates DO receive the routing
40
+ /// context (target/source <see cref="InstanceId"/>) as a parameter.
41
+ /// Mirrors <see cref="FlatDispatchEntry{TMessage}"/> with the
42
+ /// context-carrying delegate shape.
43
+ /// </summary>
44
+ /// <typeparam name="TMessage">Concrete message type of the dispatch slot.</typeparam>
45
+ internal readonly struct ContextFlatDispatchEntry<TMessage>
46
+ where TMessage : IMessage
47
+ {
48
+ public ContextFlatDispatchEntry(
49
+ MessageHandler handler,
50
+ MessageHandler.FastHandlerWithContext<TMessage> invoker
51
+ )
52
+ {
53
+ this.handler = handler;
54
+ this.invoker = invoker;
55
+ }
56
+
57
+ public readonly MessageHandler handler;
58
+ public readonly MessageHandler.FastHandlerWithContext<TMessage> invoker;
59
+ }
60
+
61
+ /// <summary>
62
+ /// Non-generic erasure base so the non-generic
63
+ /// <c>MessageBus.DispatchSnapshot</c> can carry and release a typed flat
64
+ /// entry array without knowing the closed message type (or the entry
65
+ /// shape). The snapshot's pooled-release path calls <see cref="Release"/>
66
+ /// exactly once per snapshot teardown; the typed holder returns its array
67
+ /// to the per-closed-generic pool.
68
+ /// </summary>
69
+ internal abstract class FlatDispatchArray
70
+ {
71
+ internal abstract void Release();
72
+ }
73
+
74
+ /// <summary>
75
+ /// Shared pooled-holder implementation for flat dispatch arrays: a pooled
76
+ /// entry array (rented from <see cref="ArrayPool{T}"/>) plus a small
77
+ /// per-closed-generic holder stack so registration-churn rebuilds
78
+ /// allocate nothing in steady state. Concrete holders
79
+ /// (<see cref="FlatDispatch{TMessage}"/>,
80
+ /// <see cref="ContextFlatDispatch{TMessage}"/>) only pick the entry
81
+ /// shape; all lifecycle logic lives here so the pool/lock/cap/released
82
+ /// pattern exists exactly once.
83
+ /// </summary>
84
+ /// <remarks>
85
+ /// Lifecycle mirrors the snapshot that owns the holder: the array is
86
+ /// frozen for the duration of any emission that acquired it (mutations
87
+ /// mark the owning DispatchState dirty and are observed by the NEXT
88
+ /// emission's rebuild), and it is released back to the pool only through
89
+ /// <c>DispatchSnapshot.Release()</c>. The <c>_released</c> flag guards
90
+ /// the holder against double-release (which would seat the same holder
91
+ /// in the pool twice and corrupt later rents): DEBUG builds assert,
92
+ /// release builds no-op the second call.
93
+ /// </remarks>
94
+ /// <typeparam name="TEntry">Resolved entry struct stored in the array.</typeparam>
95
+ /// <typeparam name="THolder">Concrete holder type (CRTP, for typed pooling).</typeparam>
96
+ internal abstract class PooledFlatDispatch<TEntry, THolder> : FlatDispatchArray
97
+ where THolder : PooledFlatDispatch<TEntry, THolder>, new()
98
+ {
99
+ private static readonly ArrayPool<TEntry> EntryPool = ArrayPool<TEntry>.Shared;
100
+
101
+ // Cold-path pool (rebuild/teardown only); the lock is uncontended in
102
+ // practice but keeps the holder pool safe if multiple buses are ever
103
+ // driven from different threads.
104
+ private static readonly Stack<THolder> HolderPool = new();
105
+ private static readonly object HolderPoolLock = new();
106
+ private const int MaxRetainedHolders = 64;
107
+
108
+ internal TEntry[] entries = Array.Empty<TEntry>();
109
+ internal int count;
110
+
111
+ // True while the holder is parked in (or eligible for) the pool;
112
+ // false while it is owned by a live DispatchSnapshot. Guards the
113
+ // rent/release lifecycle against double-release and rent-of-live.
114
+ private bool _released = true;
115
+
116
+ internal static THolder Rent(int capacity)
117
+ {
118
+ THolder holder = null;
119
+ lock (HolderPoolLock)
120
+ {
121
+ if (0 < HolderPool.Count)
122
+ {
123
+ holder = HolderPool.Pop();
124
+ }
125
+ }
126
+
127
+ holder ??= new THolder();
128
+ System.Diagnostics.Debug.Assert(
129
+ holder._released,
130
+ "PooledFlatDispatch.Rent returned a holder that is still owned by a live "
131
+ + "snapshot; a Release() was skipped or the pool was corrupted."
132
+ );
133
+ holder._released = false;
134
+ holder.entries = 0 < capacity ? EntryPool.Rent(capacity) : Array.Empty<TEntry>();
135
+ holder.count = 0;
136
+ return holder;
137
+ }
138
+
139
+ internal sealed override void Release()
140
+ {
141
+ if (_released)
142
+ {
143
+ System.Diagnostics.Debug.Assert(
144
+ false,
145
+ "PooledFlatDispatch.Release called twice on the same holder; the owning "
146
+ + "DispatchSnapshot must release its flat array exactly once."
147
+ );
148
+ return;
149
+ }
150
+
151
+ _released = true;
152
+ TEntry[] localEntries = entries;
153
+ int localCount = count;
154
+ entries = Array.Empty<TEntry>();
155
+ count = 0;
156
+ if (0 < localEntries.Length)
157
+ {
158
+ Array.Clear(localEntries, 0, localCount);
159
+ EntryPool.Return(localEntries);
160
+ }
161
+
162
+ lock (HolderPoolLock)
163
+ {
164
+ if (HolderPool.Count < MaxRetainedHolders)
165
+ {
166
+ HolderPool.Push((THolder)this);
167
+ }
168
+ }
169
+ }
170
+ }
171
+
172
+ /// <summary>
173
+ /// Pooled flat array of resolved entries for one
174
+ /// (bus, message-type[, context], phase) dispatch snapshot whose
175
+ /// delegates take only the message: untargeted handle/post and the
176
+ /// context-keyed (Default variant) targeted/broadcast handle/post slots.
177
+ /// Built at snapshot-build time by walking the bus priority buckets
178
+ /// ascending, then each bucket's MessageHandlers in bus insertion order,
179
+ /// then each handler's fast entries followed by its default entries
180
+ /// (both in first-registration order), so a plain forward iteration
181
+ /// reproduces the documented dispatch order exactly.
182
+ /// </summary>
183
+ /// <typeparam name="TMessage">Concrete message type of the dispatch slot.</typeparam>
184
+ internal sealed class FlatDispatch<TMessage>
185
+ : PooledFlatDispatch<FlatDispatchEntry<TMessage>, FlatDispatch<TMessage>>
186
+ where TMessage : IMessage { }
187
+
188
+ /// <summary>
189
+ /// Pooled flat array of resolved entries for one (bus, message-type,
190
+ /// phase) dispatch snapshot of a WithoutContext targeted/broadcast slot,
191
+ /// whose delegates receive the routing <see cref="InstanceId"/> alongside
192
+ /// the message. Build order matches <see cref="FlatDispatch{TMessage}"/>.
193
+ /// </summary>
194
+ /// <typeparam name="TMessage">Concrete message type of the dispatch slot.</typeparam>
195
+ internal sealed class ContextFlatDispatch<TMessage>
196
+ : PooledFlatDispatch<ContextFlatDispatchEntry<TMessage>, ContextFlatDispatch<TMessage>>
197
+ where TMessage : IMessage { }
198
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: a21a4ac4e7dd4fd4839dc6de875e24d8
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,38 @@
1
+ namespace DxMessaging.Core.Internal
2
+ {
3
+ /// <summary>
4
+ /// Const-int positions into <c>TypedHandler&lt;T&gt;._globalSlots[]</c>.
5
+ /// Indices are hand-written so call sites inline as immediate operands.
6
+ /// Array length and per-index <c>null</c>-ness are validated in DEBUG
7
+ /// builds via <c>TypedHandler&lt;T&gt;.ValidateSlotArrays()</c>.
8
+ /// </summary>
9
+ /// <remarks>
10
+ /// Positions are laid out in lex-(<c>Kind</c>, <c>Variant</c>) order:
11
+ /// Untargeted -&gt; Targeted -&gt; Broadcast within Kind, Default before
12
+ /// Fast within Variant. The xmldoc on each constant names the legacy
13
+ /// <c>TypedHandler&lt;T&gt;</c> field whose storage role the slot will
14
+ /// assume in typed global storage.
15
+ /// </remarks>
16
+ internal static class TypedGlobalSlotIndex
17
+ {
18
+ /// <summary>Legacy field: <c>_globalUntargetedHandlers</c>.</summary>
19
+ public const int UntargetedDefault = 0;
20
+
21
+ /// <summary>Legacy field: <c>_globalUntargetedFastHandlers</c>.</summary>
22
+ public const int UntargetedFast = 1;
23
+
24
+ /// <summary>Legacy field: <c>_globalTargetedHandlers</c>.</summary>
25
+ public const int TargetedDefault = 2;
26
+
27
+ /// <summary>Legacy field: <c>_globalTargetedFastHandlers</c>.</summary>
28
+ public const int TargetedFast = 3;
29
+
30
+ /// <summary>Legacy field: <c>_globalBroadcastHandlers</c>.</summary>
31
+ public const int BroadcastDefault = 4;
32
+
33
+ /// <summary>Legacy field: <c>_globalBroadcastFastHandlers</c>.</summary>
34
+ public const int BroadcastFast = 5;
35
+
36
+ public const int Length = 6;
37
+ }
38
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: c1d15b0be71e49828b55dc1654748f4e
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,81 @@
1
+ namespace DxMessaging.Core.Internal
2
+ {
3
+ /// <summary>
4
+ /// Const-int positions into <c>TypedHandler&lt;T&gt;._slots[]</c>. Indices
5
+ /// are hand-written so call sites inline as immediate operands. Array
6
+ /// length and per-index <c>null</c>-ness are validated in DEBUG builds via
7
+ /// <c>TypedHandler&lt;T&gt;.ValidateSlotArrays()</c>.
8
+ /// </summary>
9
+ /// <remarks>
10
+ /// Positions are laid out in lex-(<c>Kind</c>, <c>Phase</c>, <c>Variant</c>) order:
11
+ /// Untargeted -&gt; Targeted -&gt; Broadcast within Kind; Handle before
12
+ /// PostProcess within Phase; and Default -&gt; Fast -&gt; WithoutContext -&gt;
13
+ /// WithoutContextFast within Variant. The xmldoc on each constant names
14
+ /// the legacy <c>TypedHandler&lt;T&gt;</c> field whose storage role the
15
+ /// slot assumes in typed storage.
16
+ /// </remarks>
17
+ internal static class TypedSlotIndex
18
+ {
19
+ /// <summary>Legacy field: <c>_untargetedHandlers</c>.</summary>
20
+ public const int UntargetedHandleDefault = 0;
21
+
22
+ /// <summary>Legacy field: <c>_untargetedFastHandlers</c>.</summary>
23
+ public const int UntargetedHandleFast = 1;
24
+
25
+ /// <summary>Legacy field: <c>_untargetedPostProcessingHandlers</c>.</summary>
26
+ public const int UntargetedPostProcessDefault = 2;
27
+
28
+ /// <summary>Legacy field: <c>_untargetedPostProcessingFastHandlers</c>.</summary>
29
+ public const int UntargetedPostProcessFast = 3;
30
+
31
+ /// <summary>Legacy field: <c>_targetedHandlers</c>.</summary>
32
+ public const int TargetedHandleDefault = 4;
33
+
34
+ /// <summary>Legacy field: <c>_targetedFastHandlers</c>.</summary>
35
+ public const int TargetedHandleFast = 5;
36
+
37
+ /// <summary>Legacy field: <c>_targetedWithoutTargetingHandlers</c>.</summary>
38
+ public const int TargetedHandleWithoutContext = 6;
39
+
40
+ /// <summary>Legacy field: <c>_fastTargetedWithoutTargetingHandlers</c>.</summary>
41
+ public const int TargetedHandleWithoutContextFast = 7;
42
+
43
+ /// <summary>Legacy field: <c>_targetedPostProcessingHandlers</c>.</summary>
44
+ public const int TargetedPostProcessDefault = 8;
45
+
46
+ /// <summary>Legacy field: <c>_targetedPostProcessingFastHandlers</c>.</summary>
47
+ public const int TargetedPostProcessFast = 9;
48
+
49
+ /// <summary>Legacy field: <c>_targetedWithoutTargetingPostProcessingHandlers</c>.</summary>
50
+ public const int TargetedPostProcessWithoutContext = 10;
51
+
52
+ /// <summary>Legacy field: <c>_fastTargetedWithoutTargetingPostProcessingHandlers</c>.</summary>
53
+ public const int TargetedPostProcessWithoutContextFast = 11;
54
+
55
+ /// <summary>Legacy field: <c>_broadcastHandlers</c>.</summary>
56
+ public const int BroadcastHandleDefault = 12;
57
+
58
+ /// <summary>Legacy field: <c>_broadcastFastHandlers</c>.</summary>
59
+ public const int BroadcastHandleFast = 13;
60
+
61
+ /// <summary>Legacy field: <c>_broadcastWithoutSourceHandlers</c>.</summary>
62
+ public const int BroadcastHandleWithoutContext = 14;
63
+
64
+ /// <summary>Legacy field: <c>_fastBroadcastWithoutSourceHandlers</c>.</summary>
65
+ public const int BroadcastHandleWithoutContextFast = 15;
66
+
67
+ /// <summary>Legacy field: <c>_broadcastPostProcessingHandlers</c>.</summary>
68
+ public const int BroadcastPostProcessDefault = 16;
69
+
70
+ /// <summary>Legacy field: <c>_broadcastPostProcessingFastHandlers</c>.</summary>
71
+ public const int BroadcastPostProcessFast = 17;
72
+
73
+ /// <summary>Legacy field: <c>_broadcastWithoutSourcePostProcessingHandlers</c>.</summary>
74
+ public const int BroadcastPostProcessWithoutContext = 18;
75
+
76
+ /// <summary>Legacy field: <c>_fastBroadcastWithoutSourcePostProcessingHandlers</c>.</summary>
77
+ public const int BroadcastPostProcessWithoutContextFast = 19;
78
+
79
+ public const int Length = 20;
80
+ }
81
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: ef97ae16e3954ebba9ff6f003592d2da
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: