com.wallstop-studios.dxmessaging 3.0.1 → 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 (81) hide show
  1. package/CHANGELOG.md +211 -2
  2. package/Editor/Analyzers/DxMessagingConsoleHarvester.cs +69 -62
  3. package/Editor/Analyzers/Microsoft.CodeAnalysis.CSharp.dll.meta +3 -3
  4. package/Editor/Analyzers/Microsoft.CodeAnalysis.dll.meta +3 -3
  5. package/Editor/Analyzers/System.Collections.Immutable.dll.meta +3 -3
  6. package/Editor/Analyzers/System.Reflection.Metadata.dll.meta +3 -3
  7. package/Editor/Analyzers/System.Runtime.CompilerServices.Unsafe.dll.meta +3 -3
  8. package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll +0 -0
  9. package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll.meta +15 -2
  10. package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll +0 -0
  11. package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll.meta +2 -2
  12. package/Editor/AssemblyInfo.cs.meta +9 -1
  13. package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs +24 -15
  14. package/Editor/CustomEditors/MessagingComponentEditor.cs.meta +9 -1
  15. package/Editor/DxMessagingEditorIdle.cs +62 -0
  16. package/{Runtime/Core/Internal/TypedDispatchLinkIndex.cs.meta → Editor/DxMessagingEditorIdle.cs.meta} +1 -1
  17. package/Editor/DxMessagingEditorInitializer.cs +112 -15
  18. package/Editor/DxMessagingEditorInitializer.cs.meta +9 -1
  19. package/Editor/DxMessagingEditorLog.cs +32 -0
  20. package/Editor/DxMessagingEditorLog.cs.meta +11 -0
  21. package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs +135 -12
  22. package/Editor/Settings/DxMessagingSettings.cs +92 -31
  23. package/Editor/Settings/DxMessagingSettings.cs.meta +9 -1
  24. package/Editor/Settings/DxMessagingSettingsProvider.cs.meta +9 -1
  25. package/Editor/SetupCscRsp.cs +339 -173
  26. package/Editor/SetupCscRsp.cs.meta +9 -1
  27. package/Editor/Testing/MessagingComponentEditorHarness.cs +1 -1
  28. package/Editor/Testing/MessagingComponentEditorHarness.cs.meta +9 -1
  29. package/README.md +17 -18
  30. package/Runtime/AssemblyInfo.cs.meta +9 -1
  31. package/Runtime/Core/Attributes/DxAutoConstructorAttribute.cs.meta +9 -1
  32. package/Runtime/Core/Attributes/DxBroadcastMessageAttribute.cs.meta +9 -1
  33. package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs +2 -4
  34. package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs.meta +9 -1
  35. package/Runtime/Core/Attributes/DxTargetedMessageAttribute.cs.meta +9 -1
  36. package/Runtime/Core/Attributes/DxUntargetedMessageAttribute.cs.meta +9 -1
  37. package/Runtime/Core/Attributes/Il2CppSetOptionAttribute.cs +56 -0
  38. package/Runtime/Core/Attributes/Il2CppSetOptionAttribute.cs.meta +11 -0
  39. package/Runtime/Core/DataStructure/CyclicBuffer.cs +44 -26
  40. package/Runtime/Core/DataStructure/CyclicBuffer.cs.meta +9 -1
  41. package/Runtime/Core/Diagnostics/MessageEmissionData.cs.meta +9 -1
  42. package/Runtime/Core/Diagnostics/MessageRegistrationData.cs.meta +9 -1
  43. package/Runtime/Core/Diagnostics/MessageRegistrationType.cs.meta +9 -1
  44. package/Runtime/Core/Extensions/EnumExtensions.cs +6 -5
  45. package/Runtime/Core/Extensions/EnumExtensions.cs.meta +9 -1
  46. package/Runtime/Core/Extensions/IListExtensions.cs.meta +9 -1
  47. package/Runtime/Core/Extensions/MessageExtensions.cs +0 -60
  48. package/Runtime/Core/Helper/MessageCache.cs.meta +9 -1
  49. package/Runtime/Core/Helper/MessageHelperIndexer.cs.meta +9 -1
  50. package/Runtime/Core/InstanceId.cs +25 -1
  51. package/Runtime/Core/Internal/DxUnsafe.cs +60 -0
  52. package/Runtime/Core/Internal/DxUnsafe.cs.meta +11 -0
  53. package/Runtime/Core/Internal/FlatDispatch.cs +198 -0
  54. package/Runtime/Core/Internal/FlatDispatch.cs.meta +11 -0
  55. package/Runtime/Core/Internal/TypedSlots.cs +5 -21
  56. package/Runtime/Core/MessageBus/IMessageBus.cs +12 -12
  57. package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs +1 -0
  58. package/Runtime/Core/MessageBus/Internal/BusSlots.cs +7 -6
  59. package/Runtime/Core/MessageBus/MessageBus.cs +2313 -2936
  60. package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs +187 -14
  61. package/Runtime/Core/MessageHandler.cs +1023 -1143
  62. package/Runtime/Core/MessageRegistrationToken.cs +425 -47
  63. package/Runtime/Core/Messages/GlobalStringMessage.cs.meta +9 -1
  64. package/Runtime/Core/Messages/ReflexiveMessage.cs.meta +9 -1
  65. package/Runtime/Core/Messages/StringMessage.cs.meta +9 -1
  66. package/Runtime/Unity/Integrations/Reflex/AssemblyInfo.cs.meta +9 -1
  67. package/Runtime/Unity/Integrations/VContainer/AssemblyInfo.cs.meta +9 -1
  68. package/Runtime/Unity/Integrations/Zenject/AssemblyInfo.cs.meta +9 -1
  69. package/Runtime/Unity/MessageAwareComponent.cs +46 -1
  70. package/Runtime/Unity/MessagingComponent.cs +43 -10
  71. package/Runtime/WallstopStudios.DxMessaging.asmdef +1 -1
  72. package/Samples~/DI/README.md +7 -7
  73. package/SourceGenerators/Directory.Build.props +50 -3
  74. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs +96 -63
  75. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs +745 -87
  76. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs.meta +9 -1
  77. package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj +39 -46
  78. package/SourceGenerators/global.json +7 -0
  79. package/SourceGenerators/global.json.meta +7 -0
  80. package/package.json +27 -40
  81. package/Runtime/Core/Internal/TypedDispatchLinkIndex.cs +0 -51
@@ -16,21 +16,21 @@ PluginImporter:
16
16
  second:
17
17
  enabled: 0
18
18
  settings:
19
- Exclude Editor: 0
19
+ Exclude Editor: 1
20
20
  Exclude Linux64: 1
21
21
  Exclude OSXUniversal: 1
22
22
  Exclude WebGL: 1
23
23
  Exclude Win: 1
24
24
  Exclude Win64: 1
25
25
  - first:
26
- Any:
26
+ Any:
27
27
  second:
28
28
  enabled: 0
29
29
  settings: {}
30
30
  - first:
31
31
  Editor: Editor
32
32
  second:
33
- enabled: 1
33
+ enabled: 0
34
34
  settings:
35
35
  DefaultValueInitialized: true
36
36
  - first:
@@ -1,5 +1,7 @@
1
1
  fileFormatVersion: 2
2
2
  guid: e02b032423e347e9a1ae26bb48fdc978
3
+ labels:
4
+ - RoslynAnalyzer
3
5
  PluginImporter:
4
6
  externalObjects: {}
5
7
  serializedVersion: 2
@@ -12,14 +14,25 @@ PluginImporter:
12
14
  validateReferences: 1
13
15
  platformData:
14
16
  - first:
15
- Any:
17
+ : Any
18
+ second:
19
+ enabled: 0
20
+ settings:
21
+ Exclude Editor: 1
22
+ Exclude Linux64: 1
23
+ Exclude OSXUniversal: 1
24
+ Exclude WebGL: 1
25
+ Exclude Win: 1
26
+ Exclude Win64: 1
27
+ - first:
28
+ Any:
16
29
  second:
17
30
  enabled: 0
18
31
  settings: {}
19
32
  - first:
20
33
  Editor: Editor
21
34
  second:
22
- enabled: 1
35
+ enabled: 0
23
36
  settings:
24
37
  DefaultValueInitialized: true
25
38
  - first:
@@ -18,7 +18,7 @@ PluginImporter:
18
18
  second:
19
19
  enabled: 0
20
20
  settings:
21
- Exclude Editor: 0
21
+ Exclude Editor: 1
22
22
  Exclude Linux64: 1
23
23
  Exclude OSXUniversal: 1
24
24
  Exclude WebGL: 1
@@ -32,7 +32,7 @@ PluginImporter:
32
32
  - first:
33
33
  Editor: Editor
34
34
  second:
35
- enabled: 1
35
+ enabled: 0
36
36
  settings:
37
37
  CPU: AnyCPU
38
38
  DefaultValueInitialized: true
@@ -1,3 +1,11 @@
1
1
  fileFormatVersion: 2
2
2
  guid: 55bb3ae7ef064633b5fe4b17ce29f8cc
3
- timeCreated: 1761880591
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -76,8 +76,9 @@ namespace DxMessaging.Editor.CustomEditors
76
76
  }
77
77
  catch (System.Exception ex)
78
78
  {
79
- Debug.LogWarning(
80
- $"[DxMessaging] Failed to repaint inspectors after analyzer report update: {ex.Message}"
79
+ DxMessagingEditorLog.LogWarning(
80
+ "Failed to repaint inspectors after analyzer report update.",
81
+ ex
81
82
  );
82
83
  }
83
84
  }
@@ -130,7 +131,7 @@ namespace DxMessaging.Editor.CustomEditors
130
131
  {
131
132
  return;
132
133
  }
133
- int instanceId = messageAwareComponent.GetInstanceID();
134
+ int instanceId = DxMessaging.Core.InstanceId.StableId(messageAwareComponent);
134
135
  if (!_renderedThisRepaint.Add(instanceId))
135
136
  {
136
137
  return;
@@ -183,9 +184,7 @@ namespace DxMessaging.Editor.CustomEditors
183
184
  }
184
185
  catch (System.Exception ex)
185
186
  {
186
- Debug.LogWarning(
187
- $"[DxMessaging] Inspector overlay could not load settings: {ex.Message}"
188
- );
187
+ DxMessagingEditorLog.LogWarning("Inspector overlay could not load settings.", ex);
189
188
  return false;
190
189
  }
191
190
 
@@ -369,7 +368,7 @@ namespace DxMessaging.Editor.CustomEditors
369
368
  }
370
369
  catch (System.Exception ex)
371
370
  {
372
- Debug.LogWarning($"[DxMessaging] Failed to open script: {ex.Message}");
371
+ DxMessagingEditorLog.LogWarning("Failed to open script.", ex);
373
372
  }
374
373
  }
375
374
 
@@ -381,19 +380,24 @@ namespace DxMessaging.Editor.CustomEditors
381
380
  // frame, corrupting Unity's per-window layout cache. delayCall fires AFTER the
382
381
  // current GUI cycle, so the next frame's Layout pass sees the new state and
383
382
  // both passes emit consistent control counts.
384
- EditorApplication.delayCall += () =>
383
+ DxMessagingEditorIdle.ScheduleAssetDatabaseMutation(() =>
385
384
  {
385
+ if (settings == null)
386
+ {
387
+ return;
388
+ }
386
389
  try
387
390
  {
388
391
  settings.AddIgnoredType(fullName);
389
392
  }
390
393
  catch (System.Exception ex)
391
394
  {
392
- Debug.LogWarning(
393
- $"[DxMessaging] Failed to add ignored type '{fullName}': {ex.Message}"
395
+ DxMessagingEditorLog.LogWarning(
396
+ $"Failed to add ignored type '{fullName}'.",
397
+ ex
394
398
  );
395
399
  }
396
- };
400
+ });
397
401
  }
398
402
 
399
403
  private static void TryRemoveIgnoredType(DxMessagingSettings settings, string fullName)
@@ -401,19 +405,24 @@ namespace DxMessaging.Editor.CustomEditors
401
405
  // Same reasoning as TryAddIgnoredType: defer mutation past the current GUI cycle so
402
406
  // the overlay's shape gating remains identical on Layout and Repaint passes of THIS
403
407
  // frame. The next frame's Layout pass observes the new state; both passes agree.
404
- EditorApplication.delayCall += () =>
408
+ DxMessagingEditorIdle.ScheduleAssetDatabaseMutation(() =>
405
409
  {
410
+ if (settings == null)
411
+ {
412
+ return;
413
+ }
406
414
  try
407
415
  {
408
416
  settings.RemoveIgnoredType(fullName);
409
417
  }
410
418
  catch (System.Exception ex)
411
419
  {
412
- Debug.LogWarning(
413
- $"[DxMessaging] Failed to remove ignored type '{fullName}': {ex.Message}"
420
+ DxMessagingEditorLog.LogWarning(
421
+ $"Failed to remove ignored type '{fullName}'.",
422
+ ex
414
423
  );
415
424
  }
416
- };
425
+ });
417
426
  }
418
427
  }
419
428
  #endif
@@ -1,3 +1,11 @@
1
1
  fileFormatVersion: 2
2
2
  guid: e078b310572343318b79a3c00d0f274d
3
- timeCreated: 1749666380
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,62 @@
1
+ namespace DxMessaging.Editor
2
+ {
3
+ #if UNITY_EDITOR
4
+ using System;
5
+ using UnityEditor;
6
+
7
+ /// <summary>
8
+ /// Shared guard for editor callbacks that mutate Unity's AssetDatabase.
9
+ /// </summary>
10
+ internal static class DxMessagingEditorIdle
11
+ {
12
+ internal static bool CanMutateAssetDatabase()
13
+ {
14
+ return !EditorApplication.isUpdating && !EditorApplication.isCompiling;
15
+ }
16
+
17
+ internal static void ScheduleAssetDatabaseMutation(Action work)
18
+ {
19
+ ScheduleAssetDatabaseMutation(work, ScheduleDelayCall, CanMutateAssetDatabase);
20
+ }
21
+
22
+ internal static void ScheduleAssetDatabaseMutation(
23
+ Action work,
24
+ Action<Action> scheduler,
25
+ Func<bool> canMutateAssetDatabase
26
+ )
27
+ {
28
+ if (work == null)
29
+ {
30
+ return;
31
+ }
32
+
33
+ Action<Action> effectiveScheduler = scheduler ?? ScheduleDelayCall;
34
+ Func<bool> effectiveCanMutate = canMutateAssetDatabase ?? CanMutateAssetDatabase;
35
+
36
+ effectiveScheduler(() =>
37
+ RunAssetDatabaseMutationWhenIdle(work, effectiveScheduler, effectiveCanMutate)
38
+ );
39
+ }
40
+
41
+ private static void RunAssetDatabaseMutationWhenIdle(
42
+ Action work,
43
+ Action<Action> scheduler,
44
+ Func<bool> canMutateAssetDatabase
45
+ )
46
+ {
47
+ if (!canMutateAssetDatabase())
48
+ {
49
+ ScheduleAssetDatabaseMutation(work, scheduler, canMutateAssetDatabase);
50
+ return;
51
+ }
52
+
53
+ work();
54
+ }
55
+
56
+ private static void ScheduleDelayCall(Action work)
57
+ {
58
+ EditorApplication.delayCall += () => work();
59
+ }
60
+ }
61
+ #endif
62
+ }
@@ -1,5 +1,5 @@
1
1
  fileFormatVersion: 2
2
- guid: 031ffa9bfbf249728da382bb9e03b017
2
+ guid: 6f73f10f1fd14bb6bc417bc2e23f425d
3
3
  MonoImporter:
4
4
  externalObjects: {}
5
5
  serializedVersion: 2
@@ -1,6 +1,7 @@
1
1
  namespace DxMessaging.Editor
2
2
  {
3
3
  #if UNITY_EDITOR
4
+ using System;
4
5
  using Core;
5
6
  using Core.MessageBus;
6
7
  using Settings;
@@ -13,13 +14,30 @@ namespace DxMessaging.Editor
13
14
  [InitializeOnLoad]
14
15
  public static class DxMessagingEditorInitializer
15
16
  {
17
+ internal const string DomainReloadWarningMessage =
18
+ "[DxMessaging] Enter Play Mode Options are disabling domain reload. "
19
+ + "DxMessaging resets its internal statics, but third-party static state will persist. "
20
+ + "Audit integration code or re-enable domain reload if inconsistent behaviour occurs.";
21
+
16
22
  private static bool s_playModeWarningIssued;
23
+ private static bool s_ensureSettingsAssetScheduled;
24
+
25
+ internal static Action StaticStateResetter { get; set; } = DxMessagingStaticState.Reset;
26
+ internal static Func<DxMessagingSettings> PassiveSettingsLoader { get; set; } =
27
+ DxMessagingSettings.LoadSettingsPassive;
28
+ internal static Func<DxMessagingSettings> SettingsAssetEnsurer { get; set; } =
29
+ DxMessagingSettings.GetOrCreateSettings;
30
+ internal static Action<Action> AssetDatabaseMutationScheduler { get; set; } =
31
+ DxMessagingEditorIdle.ScheduleAssetDatabaseMutation;
32
+ internal static Func<bool> DomainReloadDisabledDetector { get; set; } =
33
+ IsDomainReloadDisabled;
34
+ internal static Action<string> DomainReloadWarningLogger { get; set; } =
35
+ message => Debug.LogWarning(message);
17
36
 
18
37
  static DxMessagingEditorInitializer()
19
38
  {
20
39
  EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
21
40
  ApplyEditorSettings();
22
- WarnIfDomainReloadDisabled();
23
41
  }
24
42
 
25
43
  private static void OnPlayModeStateChanged(PlayModeStateChange stateChange)
@@ -30,7 +48,6 @@ namespace DxMessaging.Editor
30
48
  )
31
49
  {
32
50
  ApplyEditorSettings();
33
- WarnIfDomainReloadDisabled();
34
51
  }
35
52
  }
36
53
 
@@ -45,34 +62,114 @@ namespace DxMessaging.Editor
45
62
  ApplyEditorSettings();
46
63
  }
47
64
 
48
- private static void ApplyEditorSettings()
65
+ internal static void ApplyEditorSettings()
66
+ {
67
+ (StaticStateResetter ?? DxMessagingStaticState.Reset)();
68
+
69
+ // Issue #210: ApplyEditorSettings is reachable from the [InitializeOnLoad] static
70
+ // constructor during the domain-load asset-import window, where a synchronous
71
+ // AssetDatabase mutation -- the CreateAsset/SaveAssets/legacy-migration inside
72
+ // GetOrCreateSettings -- can re-enter the importer and hard-crash the native editor
73
+ // (GuidReservations::Reserve abort on Unity 6000.4+). Read current values via a
74
+ // mutation-free passive load now; ensure the asset exists/migrates on the next editor
75
+ // tick, off the import window.
76
+ Func<DxMessagingSettings> passiveSettingsLoader =
77
+ PassiveSettingsLoader ?? DxMessagingSettings.LoadSettingsPassive;
78
+ ApplySettingsAndDiagnostics(passiveSettingsLoader());
79
+ ScheduleEnsureSettingsAsset();
80
+ }
81
+
82
+ private static void ScheduleEnsureSettingsAsset()
83
+ {
84
+ // Debounce: ApplyEditorSettings runs from the cctor and on every play-mode transition,
85
+ // so coalesce to a single pending callback (mirrors the harvester's _rescanScheduled
86
+ // latch) instead of stacking redundant delayCall registrations.
87
+ if (s_ensureSettingsAssetScheduled)
88
+ {
89
+ return;
90
+ }
91
+ s_ensureSettingsAssetScheduled = true;
92
+ Action<Action> scheduler =
93
+ AssetDatabaseMutationScheduler
94
+ ?? DxMessagingEditorIdle.ScheduleAssetDatabaseMutation;
95
+ scheduler(EnsureSettingsAssetThenApplyGlobals);
96
+ }
97
+
98
+ private static void EnsureSettingsAssetThenApplyGlobals()
49
99
  {
50
- DxMessagingStaticState.Reset();
51
- DxMessagingSettings settings = DxMessagingSettings.GetOrCreateSettings();
100
+ // Clear the latch BEFORE the work so a throw still leaves the next ApplyEditorSettings
101
+ // free to reschedule (self-healing). GetOrCreateSettings touches the AssetDatabase, so
102
+ // this callback must only be scheduled through DxMessagingEditorIdle's idle gate. Guard
103
+ // defensively rather than letting an exception escape this editor callback.
104
+ s_ensureSettingsAssetScheduled = false;
105
+ try
106
+ {
107
+ Func<DxMessagingSettings> settingsAssetEnsurer =
108
+ SettingsAssetEnsurer ?? DxMessagingSettings.GetOrCreateSettings;
109
+ ApplySettingsAndDiagnostics(settingsAssetEnsurer());
110
+ }
111
+ catch (Exception ex)
112
+ {
113
+ DxMessagingEditorLog.LogWarning(
114
+ "Deferred settings initialization failed; will retry on the next editor settings refresh.",
115
+ ex
116
+ );
117
+ }
118
+ }
119
+
120
+ private static void ApplySettingsAndDiagnostics(DxMessagingSettings settings)
121
+ {
122
+ ApplyGlobals(settings);
123
+ WarnIfDomainReloadDisabled(settings);
124
+ }
125
+
126
+ private static void ApplyGlobals(DxMessagingSettings settings)
127
+ {
128
+ if (settings == null)
129
+ {
130
+ return;
131
+ }
52
132
  IMessageBus.GlobalDiagnosticsTargets = settings.DiagnosticsTargets;
53
133
  IMessageBus.GlobalMessageBufferSize = settings.MessageBufferSize;
54
134
  }
55
135
 
56
- private static void WarnIfDomainReloadDisabled()
136
+ internal static void ResetTestSeams()
137
+ {
138
+ s_playModeWarningIssued = false;
139
+ s_ensureSettingsAssetScheduled = false;
140
+ StaticStateResetter = DxMessagingStaticState.Reset;
141
+ PassiveSettingsLoader = DxMessagingSettings.LoadSettingsPassive;
142
+ SettingsAssetEnsurer = DxMessagingSettings.GetOrCreateSettings;
143
+ AssetDatabaseMutationScheduler = DxMessagingEditorIdle.ScheduleAssetDatabaseMutation;
144
+ DomainReloadDisabledDetector = IsDomainReloadDisabled;
145
+ DomainReloadWarningLogger = message => Debug.LogWarning(message);
146
+ }
147
+
148
+ private static void WarnIfDomainReloadDisabled(DxMessagingSettings settings)
57
149
  {
58
- DxMessagingSettings settings = DxMessagingSettings.GetOrCreateSettings();
150
+ // Missing settings cannot be created from the domain-load passive path. The deferred
151
+ // ensure callback re-enters this method with the realized asset, so an initial null
152
+ // never permanently suppresses an explicitly unsuppressed settings asset.
59
153
  if (
60
154
  s_playModeWarningIssued
155
+ || settings == null
61
156
  || settings.SuppressDomainReloadWarning
62
- || !EditorSettings.enterPlayModeOptionsEnabled
63
- || (EditorSettings.enterPlayModeOptions & EnterPlayModeOptions.DisableDomainReload)
64
- == 0
157
+ || !(DomainReloadDisabledDetector ?? IsDomainReloadDisabled)()
65
158
  )
66
159
  {
67
160
  return;
68
161
  }
69
162
 
70
163
  s_playModeWarningIssued = true;
71
- Debug.LogWarning(
72
- "[DxMessaging] Enter Play Mode Options are disabling domain reload. "
73
- + "DxMessaging resets its internal statics, but third-party static state will persist. "
74
- + "Audit integration code or re-enable domain reload if inconsistent behaviour occurs."
75
- );
164
+ Action<string> warningLogger = DomainReloadWarningLogger ?? Debug.LogWarning;
165
+ warningLogger(DomainReloadWarningMessage);
166
+ }
167
+
168
+ private static bool IsDomainReloadDisabled()
169
+ {
170
+ return EditorSettings.enterPlayModeOptionsEnabled
171
+ && (EditorSettings.enterPlayModeOptions & EnterPlayModeOptions.DisableDomainReload)
172
+ != 0;
76
173
  }
77
174
  }
78
175
  #endif
@@ -1,3 +1,11 @@
1
1
  fileFormatVersion: 2
2
2
  guid: b5eeb11bcc9d4d70861d5dc7084daae5
3
- timeCreated: 1749668189
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,32 @@
1
+ namespace DxMessaging.Editor
2
+ {
3
+ #if UNITY_EDITOR
4
+ using System;
5
+ using UnityEngine;
6
+
7
+ internal static class DxMessagingEditorLog
8
+ {
9
+ internal static void LogWarning(string message, Exception exception)
10
+ {
11
+ if (exception == null)
12
+ {
13
+ Debug.LogWarning($"[DxMessaging] {message}");
14
+ return;
15
+ }
16
+
17
+ Debug.LogWarning($"[DxMessaging] {message}{Environment.NewLine}{exception}");
18
+ }
19
+
20
+ internal static void LogError(string message, Exception exception)
21
+ {
22
+ if (exception == null)
23
+ {
24
+ Debug.LogError($"[DxMessaging] {message}");
25
+ return;
26
+ }
27
+
28
+ Debug.LogError($"[DxMessaging] {message}{Environment.NewLine}{exception}");
29
+ }
30
+ }
31
+ #endif
32
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 7bfe4ed77fde4c05ab5bb314d8e7a4c0
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: