Skip to content

Commit 8c65e40

Browse files
committed
Removed additional version constant and used the existing k_Version to handle migration.
1 parent a521b32 commit 8c65e40

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ namespace UnityEngine.InputSystem.Editor
3030
internal class InputActionImporter : ScriptedImporter
3131
{
3232
private const int kVersion = 13;
33-
// Bump this whenever you make a breaking change to the on-disk JSON format
34-
private const int kJsonFormatVersion = 1;
3533

3634
[SerializeField] private bool m_GenerateWrapperCode;
3735
[SerializeField] private string m_WrapperCodePath;
@@ -71,10 +69,10 @@ private static InputActionAsset CreateFromJson(AssetImportContext context)
7169
asset.LoadFromJson(content);
7270

7371
// If this JSON was authored before we switched to enum-by-value, migrate it now
74-
if (asset.m_Version < kJsonFormatVersion)
72+
if (asset.m_Version < kVersion)
7573
{
7674
MigrateAllEnumParams(asset);
77-
asset.m_Version = kJsonFormatVersion;
75+
asset.m_Version = kVersion;
7876

7977
if (!EditorHelpers.WriteAsset(context.assetPath, asset.ToJson()))
8078
context.LogImportError($"Could not write migrated JSON to '{context.assetPath}'");
@@ -133,7 +131,7 @@ private static InputActionAsset CreateFromJson(AssetImportContext context)
133131
return asset;
134132
}
135133

136-
static void MigrateAllEnumParams(InputActionAsset asset)
134+
internal static void MigrateAllEnumParams(InputActionAsset asset)
137135
{
138136
foreach (var map in asset.actionMaps)
139137
{
@@ -176,7 +174,7 @@ static void MigrateAllEnumParams(InputActionAsset asset)
176174
}
177175
}
178176

179-
static string PatchEnumArgs(Type procType, string args)
177+
internal static string PatchEnumArgs(Type procType, string args)
180178
{
181179
var dict = args.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).Select(p => p.Split('=')).ToDictionary(kv => kv[0], kv => kv[1]);
182180
var anyChanged = false;

0 commit comments

Comments
 (0)