@@ -195,6 +195,7 @@ class SettingsContent
195195 public static readonly GUIContent requireAEP = EditorGUIUtility . TrTextContent ( "Require ES3.1+AEP" ) ;
196196 public static readonly GUIContent require32 = EditorGUIUtility . TrTextContent ( "Require ES3.2" ) ;
197197 public static readonly GUIContent skinOnGPU = EditorGUIUtility . TrTextContent ( "GPU Skinning*" , "Calculate mesh skinning and blend shapes on the GPU via shaders" ) ;
198+ public static readonly GUIContent [ ] meshDeformations = { EditorGUIUtility . TrTextContent ( "CPU" ) , EditorGUIUtility . TrTextContent ( "GPU" ) , EditorGUIUtility . TrTextContent ( "GPU (Batched)" ) } ;
198199 public static readonly GUIContent scriptingDefineSymbols = EditorGUIUtility . TrTextContent ( "Scripting Define Symbols" , "Preprocessor defines passed to the C# script compiler." ) ;
199200 public static readonly GUIContent additionalCompilerArguments = EditorGUIUtility . TrTextContent ( "Additional Compiler Arguments" , "Additional arguments passed to the C# script compiler." ) ;
200201 public static readonly GUIContent scriptingDefineSymbolsApply = EditorGUIUtility . TrTextContent ( "Apply" ) ;
@@ -258,28 +259,30 @@ class SettingsContent
258259 public static readonly GUIContent allowHDRDisplay = EditorGUIUtility . TrTextContent ( "Allow HDR Display Output*" , "Checks if the display supports HDR and if it does, switches to HDR output at the start of the application." ) ;
259260 public static readonly GUIContent hdrOutputRequireHDRRenderingWarning = EditorGUIUtility . TrTextContent ( "The active Render Pipeline does not have HDR enabled. Enable HDR in the Render Pipeline Asset to see the changes." ) ;
260261
261- public static string undoChangedBatchingString { get { return LocalizationDatabase . GetLocalizedString ( "Changed Batching Settings" ) ; } }
262- public static string undoChangedGraphicsAPIString { get { return LocalizationDatabase . GetLocalizedString ( "Changed Graphics API Settings" ) ; } }
263- public static string undoChangedScriptingDefineString { get { return LocalizationDatabase . GetLocalizedString ( "Changed Scripting Define Settings" ) ; } }
264- public static string undoChangedGraphicsJobsString { get { return LocalizationDatabase . GetLocalizedString ( "Changed Graphics Jobs Setting" ) ; } }
265- public static string undoChangedGraphicsJobModeString { get { return LocalizationDatabase . GetLocalizedString ( "Changed Graphics Job Mode Setting" ) ; } }
266- public static string changeColorSpaceString { get { return LocalizationDatabase . GetLocalizedString ( "Changing the color space may take a significant amount of time." ) ; } }
267- public static string undoChangedPlatformShaderChunkSizeString { get { return LocalizationDatabase . GetLocalizedString ( "Changed Shader Chunk Size Platform Setting" ) ; } }
268- public static string undoChangedPlatformShaderChunkCountString { get { return LocalizationDatabase . GetLocalizedString ( "Changed Shader Chunk Count Platform Setting" ) ; } }
269- public static string undoChangedDefaultShaderChunkSizeString { get { return LocalizationDatabase . GetLocalizedString ( "Changed Shader Chunk Size Default Setting" ) ; } }
270- public static string undoChangedDefaultShaderChunkCountString { get { return LocalizationDatabase . GetLocalizedString ( "Changed Shader Chunk Count Default Setting" ) ; } }
262+ public static readonly string undoChangedBatchingString = L10n . Tr ( "Changed Batching Settings" ) ;
263+ public static readonly string undoChangedGraphicsAPIString = L10n . Tr ( "Changed Graphics API Settings" ) ;
264+ public static readonly string undoChangedScriptingDefineString = L10n . Tr ( "Changed Scripting Define Settings" ) ;
265+ public static readonly string undoChangedGraphicsJobsString = L10n . Tr ( "Changed Graphics Jobs Setting" ) ;
266+ public static readonly string undoChangedGraphicsJobModeString = L10n . Tr ( "Changed Graphics Job Mode Setting" ) ;
267+ public static readonly string changeColorSpaceString = L10n . Tr ( "Changing the color space may take a significant amount of time." ) ;
268+ public static readonly string undoChangedPlatformShaderChunkSizeString = L10n . Tr ( "Changed Shader Chunk Size Platform Setting" ) ;
269+ public static readonly string undoChangedPlatformShaderChunkCountString = L10n . Tr ( "Changed Shader Chunk Count Platform Setting" ) ;
270+ public static readonly string undoChangedDefaultShaderChunkSizeString = L10n . Tr ( "Changed Shader Chunk Size Default Setting" ) ;
271+ public static readonly string undoChangedDefaultShaderChunkCountString = L10n . Tr ( "Changed Shader Chunk Count Default Setting" ) ;
271272 }
272273
273274 class RecompileReason
274275 {
275- public static readonly string scriptingDefineSymbolsModified = "Scripting define symbols setting modified" ;
276- public static readonly string suppressCommonWarningsModified = "Suppress common warnings setting modified" ;
277- public static readonly string allowUnsafeCodeModified = "Allow 'unsafe' code setting modified" ;
278- public static readonly string apiCompatibilityLevelModified = "API Compatibility level modified" ;
279- public static readonly string editorAssembliesCompatibilityLevelModified = "Editor Assemblies Compatibility level modified" ;
280- public static readonly string useDeterministicCompilationModified = "Use deterministic compilation modified" ;
281- public static readonly string additionalCompilerArgumentsModified = "Additional compiler arguments modified" ;
282- public static readonly string activeBuildTargetGroupModified = "Active build target group modified" ;
276+ public static readonly string scriptingDefineSymbolsModified = L10n . Tr ( "Scripting define symbols setting modified" ) ;
277+ public static readonly string suppressCommonWarningsModified = L10n . Tr ( "Suppress common warnings setting modified" ) ;
278+ public static readonly string allowUnsafeCodeModified = L10n . Tr ( "Allow 'unsafe' code setting modified" ) ;
279+ public static readonly string apiCompatibilityLevelModified = L10n . Tr ( "API Compatibility level modified" ) ;
280+ public static readonly string editorAssembliesCompatibilityLevelModified = L10n . Tr ( "Editor Assemblies Compatibility level modified" ) ;
281+ public static readonly string useDeterministicCompilationModified = L10n . Tr ( "Use deterministic compilation modified" ) ;
282+ public static readonly string additionalCompilerArgumentsModified = L10n . Tr ( "Additional compiler arguments modified" ) ;
283+ public static readonly string activeBuildTargetGroupModified = L10n . Tr ( "Active build target group modified" ) ;
284+
285+ public static readonly string presetChanged = L10n . Tr ( "Preset changed" ) ;
283286 }
284287
285288 PlayerSettingsSplashScreenEditor m_SplashScreenEditor ;
@@ -306,6 +309,7 @@ PlayerSettingsIconsEditor iconsEditor
306309
307310 private static GraphicsJobMode [ ] m_GfxJobModeValues = new GraphicsJobMode [ ] { GraphicsJobMode . Native , GraphicsJobMode . Legacy } ;
308311 private static GUIContent [ ] m_GfxJobModeNames = new GUIContent [ ] { EditorGUIUtility . TrTextContent ( "Native" ) , EditorGUIUtility . TrTextContent ( "Legacy" ) } ;
312+ private static MeshDeformation [ ] m_MeshDeformations = { MeshDeformation . CPU , MeshDeformation . GPU , MeshDeformation . GPUBatched } ;
309313
310314 // Section and tab selection state
311315
@@ -423,6 +427,7 @@ PlayerSettingsIconsEditor iconsEditor
423427 SerializedProperty m_CaptureSingleScreen ;
424428
425429 SerializedProperty m_SkinOnGPU ;
430+ SerializedProperty m_MeshDeformation ;
426431
427432 SerializedProperty m_EnableLoadStoreDebugMode ;
428433
@@ -640,6 +645,7 @@ void OnEnable()
640645 m_VisibleInBackground = FindPropertyAssert ( "visibleInBackground" ) ;
641646 m_AllowFullscreenSwitch = FindPropertyAssert ( "allowFullscreenSwitch" ) ;
642647 m_SkinOnGPU = FindPropertyAssert ( "gpuSkinning" ) ;
648+ m_MeshDeformation = FindPropertyAssert ( "meshDeformation" ) ;
643649 m_ForceSingleInstance = FindPropertyAssert ( "forceSingleInstance" ) ;
644650 m_UseFlipModelSwapchain = FindPropertyAssert ( "useFlipModelSwapchain" ) ;
645651
@@ -927,6 +933,11 @@ public override void OnInspectorGUI()
927933
928934 if ( hasPresetWindowClosed )
929935 {
936+ // We recompile after the window is closed just to make sure all the values are set/shown correctly.
937+ // There might be a smarter idea where you detect the values that have changed and only do it if it's required,
938+ // but the way the Preset window applies those changes as well as the way IMGUI works makes it difficult to track.
939+ SetReason ( RecompileReason . presetChanged ) ;
940+
930941 OnPresetSelectorClosed ( ) ;
931942 }
932943 else if ( HasReasonToCompile ( ) )
@@ -1997,11 +2008,43 @@ private void OtherSectionRenderingGUI(BuildPlatform platform, ISettingEditorExte
19972008 // GPU Skinning toggle (only show on relevant platforms)
19982009 if ( ! BuildTargetDiscovery . PlatformHasFlag ( platform . defaultTarget , TargetAttributes . GPUSkinningNotSupported ) )
19992010 {
2000- EditorGUI . BeginChangeCheck ( ) ;
2001- EditorGUILayout . PropertyField ( m_SkinOnGPU , SettingsContent . skinOnGPU ) ;
2002- if ( EditorGUI . EndChangeCheck ( ) )
2011+ /// Adding support to other platforms in progress...
2012+ bool platformSupportsBatching =
2013+ platform . namedBuildTarget == NamedBuildTarget . NintendoSwitch ||
2014+ platform . namedBuildTarget == NamedBuildTarget . PS5 ;
2015+
2016+ if ( platformSupportsBatching )
2017+ {
2018+ MeshDeformation currentDeformation = ( MeshDeformation ) m_MeshDeformation . intValue ;
2019+
2020+ EditorGUI . BeginChangeCheck ( ) ;
2021+ MeshDeformation newDeformation = BuildEnumPopup ( SettingsContent . skinOnGPU , currentDeformation , m_MeshDeformations , SettingsContent . meshDeformations ) ;
2022+ if ( EditorGUI . EndChangeCheck ( ) )
2023+ {
2024+ m_SkinOnGPU . boolValue = newDeformation != MeshDeformation . CPU ;
2025+ m_MeshDeformation . intValue = ( int ) newDeformation ;
2026+ serializedObject . ApplyModifiedProperties ( ) ;
2027+ ShaderUtil . RecreateSkinnedMeshResources ( ) ;
2028+ }
2029+ }
2030+ else
20032031 {
2004- ShaderUtil . RecreateSkinnedMeshResources ( ) ;
2032+ // Use the original checkbox UI but preserve underlying batching mode whenever possible.
2033+ // We need to do this because gpuSkinning/meshDeformation are properties which are shared between all platforms
2034+ // and if the user sets gpuSkinning mode to "enabled", we actually want to preserve "batchEnabled" if it was set for other platforms.
2035+ // Platforms that do not support batching but have meshDeformation == GPUBatched just silently use original non-batched code.
2036+ EditorGUI . BeginChangeCheck ( ) ;
2037+ EditorGUILayout . PropertyField ( m_SkinOnGPU , SettingsContent . skinOnGPU ) ;
2038+ if ( EditorGUI . EndChangeCheck ( ) )
2039+ {
2040+ // Preserve the value of m_MeshDeformation when possible.
2041+ if ( ! m_SkinOnGPU . boolValue )
2042+ m_MeshDeformation . intValue = ( int ) MeshDeformation . CPU ;
2043+ else
2044+ m_MeshDeformation . intValue = m_MeshDeformation . intValue != ( int ) MeshDeformation . CPU ? m_MeshDeformation . intValue : ( int ) MeshDeformation . GPUBatched ;
2045+ serializedObject . ApplyModifiedProperties ( ) ;
2046+ ShaderUtil . RecreateSkinnedMeshResources ( ) ;
2047+ }
20052048 }
20062049 }
20072050
@@ -2031,7 +2074,7 @@ private void OtherSectionRenderingGUI(BuildPlatform platform, ISettingEditorExte
20312074 PlayerSettings . SetGraphicsJobModeForPlatform ( platform . defaultTarget , newGfxJobMode ) ;
20322075 graphicsJobsModeOptionEnabled = false ;
20332076 }
2034- else if ( platform . namedBuildTarget == new NamedBuildTarget ( " PS5" ) )
2077+ else if ( platform . namedBuildTarget == NamedBuildTarget . PS5 )
20352078 {
20362079 // On PS5NGGC, we only have kGfxJobModeNative so we disable the options in that case
20372080 GraphicsDeviceType [ ] gfxAPIs = PlayerSettings . GetGraphicsAPIs ( platform . defaultTarget ) ;
0 commit comments