Skip to content

Commit

Permalink
Fix control path parse
Browse files Browse the repository at this point in the history
  • Loading branch information
eviltwo committed Jul 2, 2024
1 parent acd0b1d commit 6d5522d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Changelog

## [0.9.1] - 2024-07-03
## [0.9.2] - 2024-07-03
### Added
- Convert steam input action from control path.
- Fix control path parse

## [0.9.0] - 2024-07-02
### Added
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
#if SUPPORT_INPUTSYSTEM
using System.Text;
using UnityEngine.InputSystem;

namespace UnitySteamInputAdapter.Utils
{
public static class InputSystemUtility
{
private static StringBuilder _stringBuilder = new StringBuilder();

public static string GetInputControlLocalPath(InputControl inputControl)
{
return inputControl.path.Substring(inputControl.device.path.Length + 1);
return GetInputControlLocalPath(inputControl.path);
}

public static string GetInputControlLocalPath(string inputControlPath)
Expand All @@ -22,12 +25,17 @@ public static string GetInputControlLocalPath(string inputControlPath)
{
return null;
}
var device = enumerator.Current.name;
if (inputControlPath.Length <= device.Length + 2)

_stringBuilder.Clear();
while (enumerator.MoveNext())
{
return null;
if (_stringBuilder.Length > 0)
{
_stringBuilder.Append(InputControlPath.Separator);
}
_stringBuilder.Append(enumerator.Current.name);
}
return inputControlPath.Substring(device.Length + 2);
return _stringBuilder.ToString();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.eviltwo.unity-steam-input-adapter",
"displayName": "Unity Steam Input Adapter",
"version": "0.9.1",
"version": "0.9.2",
"unity": "2022.3",
"description": "Change controller input from Unity(InputSystem) to Steam(InputAction)",
"author": {
Expand Down

0 comments on commit 6d5522d

Please sign in to comment.