I tried to load an InputSystemAsset from a JSON file and overwrite it so that all InputActionProperty
’s that use the asset receive the new actions.
I have tried to use the LoadFromJson method to do this. The asset is also loaded correctly - but the InputActionProperty
’s are not updated and the old actions are still used. Here is my code:
public class InputLoader : MonoBehaviour
{
public InputActionAsset asset;
public void Awake()
{
if(!Application.isEditor)
{
var file = Path.Combine(Application.dataPath, "..", "input.json");
if(!File.Exists(file))
File.WriteAllText(file, asset.ToJson());
else
asset.LoadFromJson(File.ReadAllText(file));
Debug.LogWarning(asset.FindActionMap("Camera").FindAction("Move"));
asset.Enable();
}
}
}
Have I forgotten something or am I doing something wrong? Thanks.