@@ -51,6 +51,7 @@ private static readonly (string TabId, string PanelId)[] Tabs =
5151 // ---- UXML element fields (Setup tab) ----
5252
5353 private TextField _publishableKey , _baseUrl , _flushInterval , _flushSize ;
54+ private Toggle _testMode ;
5455 private DropdownField _initialConsent ;
5556 private Toggle _debug , _enableMobileAttribution ;
5657 private Button _btnInit , _btnFlush , _btnReset , _btnShutdown , _btnDeleteData , _btnRequestAtt ;
@@ -75,7 +76,7 @@ private static readonly (string TabId, string PanelId)[] Tabs =
7576 // ---- UXML element fields (Tabs + status bar + header) ----
7677
7778 private readonly List < Button > _tabButtons = new List < Button > ( ) ;
78- private Label _prodWarning , _sdkVersionLabel , _titleLabel ;
79+ private Label _sdkVersionLabel , _titleLabel ;
7980 private Label _statusEndpoint , _statusConsent , _statusAnon , _statusUser , _statusSession , _statusQueue ;
8081
8182 // ---- UXML element fields (Log pane) ----
@@ -164,7 +165,7 @@ private T Require<T>(string name) where T : VisualElement =>
164165
165166 private void BindElements ( )
166167 {
167- _prodWarning = Require < Label > ( "prod-warning" ) ;
168+
168169 _sdkVersionLabel = Require < Label > ( "sdk-version" ) ;
169170 _titleLabel = _root . Q < Label > ( className : "title" ) ;
170171
@@ -181,17 +182,19 @@ private void BindElements()
181182 _baseUrl = Require < TextField > ( "base-url" ) ;
182183 _initialConsent = Require < DropdownField > ( "initial-consent" ) ;
183184 _debug = Require < Toggle > ( "debug" ) ;
185+ _testMode = Require < Toggle > ( "test-mode" ) ;
184186 _enableMobileAttribution = Require < Toggle > ( "enable-mobile-attribution" ) ;
185187 // Inject a tick Label — Unity 2021.3 runtime panels render the
186188 // checked state as a plain coloured square otherwise. USS hides
187189 // the tick when unchecked.
188- var debugCheckmark = _debug . Q < VisualElement > ( className : "unity-toggle__checkmark" ) ;
189- if ( debugCheckmark != null )
190+ foreach ( var toggle in new [ ] { _debug , _testMode , _enableMobileAttribution } )
190191 {
192+ var checkmark = toggle . Q < VisualElement > ( className : "unity-toggle__checkmark" ) ;
193+ if ( checkmark == null ) continue ;
191194 var tick = new Label ( "✓" ) ;
192195 tick . AddToClassList ( "debug-tick" ) ;
193196 tick . pickingMode = PickingMode . Ignore ;
194- debugCheckmark . Add ( tick ) ;
197+ checkmark . Add ( tick ) ;
195198 }
196199 _flushInterval = Require < TextField > ( "flush-interval" ) ;
197200 _flushSize = Require < TextField > ( "flush-size" ) ;
@@ -610,15 +613,9 @@ private void RefreshStatusBar()
610613 var key = ( _publishableKey . value ?? "" ) . Trim ( ) ;
611614 var overrideUrl = ( _baseUrl ? . value ?? "" ) . Trim ( ) ;
612615 bool keyEmpty = string . IsNullOrEmpty ( key ) ;
613- bool isTest = ! keyEmpty && IsTestKey ( key ) ;
614616 bool hasOverride = ! string . IsNullOrEmpty ( overrideUrl ) ;
615- // BaseUrl override skips prefix-based routing, so the prod-warning
616- // rule no longer applies (studio is in explicit-target mode).
617- string ? derivedFromKey = keyEmpty ? null : ( isTest ? Constants . SandboxBaseUrl : Constants . ProductionBaseUrl ) ;
618- string ? endpoint = hasOverride ? overrideUrl : derivedFromKey ;
619- bool warnState = hasOverride || ( ! keyEmpty && ! isTest ) ;
620- SetStatusCell ( _statusEndpoint , endpoint , warnState ? "state-warn" : "state-ok" ) ;
621- _prodWarning . EnableInClassList ( "hidden" , hasOverride || keyEmpty || isTest ) ;
617+ string ? endpoint = hasOverride ? overrideUrl : ( keyEmpty ? null : Constants . ProductionBaseUrl ) ;
618+ SetStatusCell ( _statusEndpoint , endpoint , hasOverride ? "state-warn" : "state-ok" ) ;
622619
623620 var consent = _initialised ? ImmutableAudience . CurrentConsent : ConsentOrder [ Mathf . Clamp ( _initialConsent ? . index ?? 0 , 0 , ConsentOrder . Length - 1 ) ] ;
624621 int cIdx = Array . IndexOf ( ConsentOrder , consent ) ;
@@ -676,16 +673,18 @@ internal readonly struct InitForm
676673 public readonly string BaseUrl ;
677674 public readonly ConsentLevel Consent ;
678675 public readonly bool Debug ;
676+ public readonly bool TestMode ;
679677 public readonly bool EnableMobileAttribution ;
680678 public readonly int ? FlushIntervalMs ;
681679 public readonly int ? FlushSize ;
682680
683- public InitForm ( string publishableKey , string baseUrl , ConsentLevel consent , bool debug , bool enableMobileAttribution , int ? flushIntervalMs , int ? flushSize )
681+ public InitForm ( string publishableKey , string baseUrl , ConsentLevel consent , bool debug , bool testMode , bool enableMobileAttribution , int ? flushIntervalMs , int ? flushSize )
684682 {
685683 PublishableKey = publishableKey ;
686684 BaseUrl = baseUrl ;
687685 Consent = consent ;
688686 Debug = debug ;
687+ TestMode = testMode ;
689688 EnableMobileAttribution = enableMobileAttribution ;
690689 FlushIntervalMs = flushIntervalMs ;
691690 FlushSize = flushSize ;
@@ -702,6 +701,7 @@ internal InitForm CaptureInitForm()
702701 baseUrl : ( _baseUrl . value ?? "" ) . Trim ( ) ,
703702 consent : ConsentOrder [ consentIdx ] ,
704703 debug : _debug . value ,
704+ testMode : _testMode . value ,
705705 enableMobileAttribution : _enableMobileAttribution . value ,
706706 flushIntervalMs : flushIntervalMs ,
707707 flushSize : flushSize ) ;
@@ -780,9 +780,6 @@ private bool IsAliasReady()
780780 && ( fromId != toId || ( _aliasFromType . value ?? "" ) != ( _aliasToType . value ?? "" ) ) ;
781781 }
782782
783- private static bool IsTestKey ( string ? key ) =>
784- ! string . IsNullOrEmpty ( key ) && key ! . StartsWith ( Constants . TestKeyPrefix , StringComparison . Ordinal ) ;
785-
786783 private static void FlashCopied ( VisualElement ve )
787784 {
788785 ve . AddToClassList ( "copied" ) ;
0 commit comments