@@ -48,6 +48,10 @@ public ConfigStyle(string label, string error, string button = "Fix",
4848 label : "Run In Background" ,
4949 error : "Run In Background must be True for Render Streaming to work in Background." ) ;
5050
51+ static readonly ConfigStyle inputSystemSettingsAssets = new ConfigStyle (
52+ label : "Input System Settings Assets" ,
53+ error : "Input System Settings asset must exist under the Assets folder for changes." ) ;
54+
5155 static readonly ConfigStyle inputSystemBackgroundBehavior = new ConfigStyle (
5256 label : "InputSystem Background Behavior" ,
5357 error : "InputSystem Background Behavior must be Ignore Focus for Input System to work in Background." ) ;
@@ -105,13 +109,14 @@ enum Scope
105109 struct Entry
106110 {
107111 public delegate bool Checker ( ) ;
108-
109112 public delegate void Fixer ( ) ;
113+ public delegate bool DependChecker ( ) ;
110114
111115 public readonly Scope scope ;
112116 public readonly ConfigStyle configStyle ;
113117 public readonly Checker check ;
114118 public readonly Fixer fix ;
119+ public readonly DependChecker dependChecker ;
115120 public readonly bool forceDisplayCheck ;
116121 public readonly bool skipErrorIcon ;
117122
@@ -120,6 +125,7 @@ public Entry(
120125 ConfigStyle configStyle ,
121126 Checker check ,
122127 Fixer fix ,
128+ DependChecker dependChecker = null ,
123129 bool forceDisplayCheck = false ,
124130 bool skipErrorIcon = false
125131 )
@@ -128,6 +134,7 @@ public Entry(
128134 this . configStyle = configStyle ;
129135 this . check = check ;
130136 this . fix = fix ;
137+ this . dependChecker = dependChecker ;
131138 this . forceDisplayCheck = forceDisplayCheck ;
132139 this . skipErrorIcon = skipErrorIcon ;
133140 }
@@ -144,12 +151,15 @@ Entry[] Entries
144151 entries = new [ ]
145152 {
146153 new Entry ( Scope . PlayMode , runInBackground , IsRunInBackgroundCorrect , FixRunInBackground ) ,
154+ new Entry ( Scope . PlayMode , inputSystemSettingsAssets , IsInputSettingsAssetsExists , FixInputSettingsAssets ) ,
147155 new Entry ( Scope . PlayMode , inputSystemBackgroundBehavior ,
148156 IsInputSystemBackgroundBehaviorCorrect ,
149- FixInputSystemBackgroundBehavior ) ,
157+ FixInputSystemBackgroundBehavior ,
158+ IsInputSettingsAssetsExists ) ,
150159 new Entry ( Scope . PlayMode , inputSystemPlayModeInputBehavior ,
151160 IsInputSystemPlayModeInputBehaviorCorrect ,
152- FixInputSystemPlayModeInputBehavior ) ,
161+ FixInputSystemPlayModeInputBehavior ,
162+ IsInputSettingsAssetsExists ) ,
153163 new Entry ( Scope . BuildSettings , currentBuildTarget , IsSupportedBuildTarget , FixSupportedBuildTarget ) ,
154164 new Entry ( Scope . BuildSettings , currentGraphicsApi , IsSupportedGraphics , FixSupportedGraphics ) ,
155165 new Entry ( Scope . BuildSettings , macCameraUsageDescription , IsMacCameraUsageCorrect , FixMacCameraUsage ) ,
@@ -174,6 +184,19 @@ Entry[] Entries
174184 private static bool IsRunInBackgroundCorrect ( ) => PlayerSettings . runInBackground ;
175185 private static void FixRunInBackground ( ) => PlayerSettings . runInBackground = true ;
176186
187+ private static bool IsInputSettingsAssetsExists ( )
188+ {
189+ var path = AssetDatabase . GetAssetPath ( UnityEngine . InputSystem . InputSystem . settings ) ;
190+ return ! string . IsNullOrEmpty ( path ) && path . StartsWith ( "Assets/" ) ;
191+ }
192+
193+ private static void FixInputSettingsAssets ( )
194+ {
195+ var inputSettings = CreateInstance < InputSettings > ( ) ;
196+ AssetDatabase . CreateAsset ( inputSettings , $ "Assets/{ PlayerSettings . productName } .inputsettings.asset") ;
197+ UnityEngine . InputSystem . InputSystem . settings = inputSettings ;
198+ }
199+
177200 private static bool IsInputSystemBackgroundBehaviorCorrect ( ) =>
178201 UnityEngine . InputSystem . InputSystem . settings . backgroundBehavior == InputSettings . BackgroundBehavior . IgnoreFocus ;
179202
@@ -510,6 +533,7 @@ private void BindChecker()
510533 entry . configStyle . button ,
511534 ( ) => entry . check ( ) ,
512535 entry . fix == null ? ( Action ) null : ( ) => entry . fix ( ) ,
536+ entry . dependChecker == null ? ( Func < bool > ) null : ( ) => entry . dependChecker ( ) ,
513537 entry . configStyle . messageType == MessageType . Error || entry . forceDisplayCheck ,
514538 entry . skipErrorIcon ) ) ;
515539 }
@@ -523,6 +547,7 @@ private void BindChecker()
523547 entry . configStyle . button ,
524548 ( ) => entry . check ( ) ,
525549 entry . fix == null ? ( Action ) null : ( ) => entry . fix ( ) ,
550+ entry . dependChecker == null ? ( Func < bool > ) null : ( ) => entry . dependChecker ( ) ,
526551 entry . configStyle . messageType == MessageType . Error || entry . forceDisplayCheck ,
527552 entry . skipErrorIcon ) ) ;
528553 }
0 commit comments