Skip to content

Commit 15f53d8

Browse files
authored
Fix Compatibility errors
Change InpuSystem to GameInput to fix compatibility errors
1 parent ffb0dae commit 15f53d8

20 files changed

+479
-121
lines changed

Editor.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/InputSettingsWindow.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ private void OnGUI()
1515
{
1616
GUILayout.Label("Input Settings", EditorStyles.boldLabel);
1717

18-
inputSettings = InputSystemProjectSettings.selectedInputSettings;
18+
inputSettings = GameInputProjectSettings.selectedInputSettings;
1919
inputSettings = (InputSettings)EditorGUILayout.ObjectField("Input Settings", inputSettings, typeof(InputSettings), false);
2020

2121
if (inputSettings != null)
@@ -27,8 +27,8 @@ private void OnGUI()
2727
serializedObject.ApplyModifiedProperties();
2828
}
2929

30-
InputSystem.main.settings = inputSettings;
30+
GameInput.main.settings = inputSettings;
3131

32-
InputSystemProjectSettings.selectedInputSettings = inputSettings;
32+
GameInputProjectSettings.selectedInputSettings = inputSettings;
3333
}
3434
}

Editor/InputSettingsWindow.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/InputSystemProjectSettings.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
using UnityEditor;
22
using UnityEngine;
3-
using UnityEngine.InputSystem;
43

5-
static class InputSystemProjectSettings
4+
static class GameInputProjectSettings
65
{
76
public static InputSettings selectedInputSettings;
87

98
[SettingsProvider]
10-
public static SettingsProvider CreateInputSystemSettingsProvider()
9+
public static SettingsProvider CreateGameInputSettingsProvider()
1110
{
12-
var provider = new SettingsProvider("Project/InputSystem", SettingsScope.Project)
11+
var provider = new SettingsProvider("Project/GameInput", SettingsScope.Project)
1312
{
1413
label = "Input System",
1514
guiHandler = (searchContext) =>
1615
{
1716
selectedInputSettings = (InputSettings)EditorGUILayout.ObjectField("Input Settings", selectedInputSettings, typeof(InputSettings), false);
18-
InputSystem.selectedSettings = selectedInputSettings;
17+
GameInput.selectedSettings = selectedInputSettings;
1918

2019
if (selectedInputSettings == null)
2120
{
@@ -48,20 +47,20 @@ public static SettingsProvider CreateInputSystemSettingsProvider()
4847

4948
public static void LoadSettings()
5049
{
51-
string path = EditorPrefs.GetString("InputSystemSettingsPath", "Assets/InputSettings.asset");
50+
string path = EditorPrefs.GetString("GameInputSettingsPath", "Assets/InputSettings.asset");
5251
selectedInputSettings = AssetDatabase.LoadAssetAtPath<InputSettings>(path);
53-
InputSystem.main.settings = selectedInputSettings;
54-
InputSystem.selectedSettings = selectedInputSettings;
52+
GameInput.main.settings = selectedInputSettings;
53+
GameInput.selectedSettings = selectedInputSettings;
5554
}
5655

5756
public static void SaveSettings()
5857
{
5958
if (selectedInputSettings != null)
6059
{
6160
string path = AssetDatabase.GetAssetPath(selectedInputSettings);
62-
EditorPrefs.SetString("InputSystemSettingsPath", path);
63-
InputSystem.main.settings = selectedInputSettings;
64-
InputSystem.selectedSettings = selectedInputSettings;
61+
EditorPrefs.SetString("GameInputSettingsPath", path);
62+
GameInput.main.settings = selectedInputSettings;
63+
GameInput.selectedSettings = selectedInputSettings;
6564
}
6665
}
6766
}

Editor/InputSystemProjectSettings.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Editor/KeyDrawer.cs

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using System.Collections.Generic;
21
using UnityEditor;
32
using UnityEngine;
43

5-
[CustomPropertyDrawer(typeof(InputSystem.key))]
4+
[CustomPropertyDrawer(typeof(GameInput.key))]
65
public class KeyDrawer : PropertyDrawer
76
{
87
private static string currentBindingProperty = null;
@@ -15,8 +14,6 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
1514

1615
// Set the position to draw fields
1716
Rect keyCodeRect = new Rect(position.x, position.y, position.width / 2 - 20, EditorGUIUtility.singleLineHeight);
18-
//Rect mouseButtonRect = new Rect(position.x + position.width / 4 - 20, position.y, position.width / 4 - 20, EditorGUIUtility.singleLineHeight);
19-
2017
Rect buttonRect = new Rect(position.x + position.width / 2 - 1, position.y, (position.width / 2) - 26, EditorGUIUtility.singleLineHeight);
2118
Rect cancelButtonRect = new Rect(position.x + position.width - 28, position.y, 20, EditorGUIUtility.singleLineHeight);
2219

@@ -25,7 +22,6 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
2522

2623
// Draw the fields
2724
EditorGUI.PropertyField(keyCodeRect, property.FindPropertyRelative("keyCode"), new GUIContent("Key"));
28-
//EditorGUI.PropertyField(mouseButtonRect, property.FindPropertyRelative("mouseButton"), new GUIContent("Mouse"));
2925

3026
// Draw Bind Button
3127
bool isBinding = currentBindingProperty == propertyPath;
@@ -37,32 +33,6 @@ public override void OnGUI(Rect position, SerializedProperty property, GUIConten
3733
currentBindingProperty = null;
3834
Event.current.Use();
3935
}
40-
else
41-
{
42-
if (Event.current.type == EventType.MouseDown)
43-
{
44-
if (Event.current.button == 0)
45-
{
46-
property.FindPropertyRelative("keyCode").intValue = (int)KeyCode.Mouse0;
47-
currentBindingProperty = null;
48-
Event.current.Use();
49-
}
50-
51-
if (Event.current.button == 1)
52-
{
53-
property.FindPropertyRelative("keyCode").intValue = (int)KeyCode.Mouse1;
54-
currentBindingProperty = null;
55-
Event.current.Use();
56-
}
57-
58-
if (Event.current.button == 2)
59-
{
60-
property.FindPropertyRelative("keyCode").intValue = (int)KeyCode.Mouse2;
61-
currentBindingProperty = null;
62-
Event.current.Use();
63-
}
64-
}
65-
}
6636
isBinding = GUI.Toggle(buttonRect, isBinding, "Press key to bind", GUI.skin.button);
6737
}
6838
else

Editor/KeyDrawer.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

LICENSE

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
MIT License
2-
3-
Copyright (c) 2024 Marco Matoso
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
11-
12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
14-
15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
1+
MIT License
2+
3+
Copyright (c) 2024 Marco Matoso
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

LICENSE.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,42 @@
1-
# Custom Input System
2-
3-
A custom input system that uses both the new and old Unity input systems.
4-
5-
## Table of Contents
6-
7-
- Features
8-
- Installation
9-
- Usage
10-
11-
## Features
12-
This new input system is easy to use and configure, similar to old input system functionality, this is very adaptable and you can customize it
13-
14-
## Installation
15-
16-
To install this package, follow these steps:
17-
18-
1. Open Unity and go to **Window > Package Manager**.
19-
2. Click the **+** button and select **Add package from git url** and paste ```https://github.com/AnderSystems/UnityModularInputSystem.git```.
20-
3. Configure the inputs on **Project Settings > Input System**
21-
22-
## Usage
23-
24-
After installing the package, you can use the custom input system in your project. Here are some examples:
25-
26-
```csharp
27-
using UnityEngine;
28-
using UnityEngine.InputSystem;
29-
30-
public class Example : MonoBehaviour
31-
{
32-
void Update()
33-
{
34-
if (InputSystem.GetButtonDown("Jump"))
35-
{
36-
Debug.Log("Jump button pressed");
37-
}
38-
39-
Vector2 move = InputSystem.GetAxis("Move");
40-
Debug.Log("Move axis: " + move);
41-
}
42-
}
1+
# Custom Input System
2+
3+
A custom input system that uses both the new and old Unity input systems.
4+
5+
## Table of Contents
6+
7+
- Features
8+
- Installation
9+
- Usage
10+
11+
## Features
12+
This new input system is easy to use and configure, similar to old input system functionality, this is very adaptable and you can customize it
13+
14+
## Installation
15+
16+
To install this package, follow these steps:
17+
18+
1. Open Unity and go to **Window > Package Manager**.
19+
2. Click the **+** button and select **Add package from git url** and paste ```https://github.com/AnderSystems/UnityModularInputSystem.git```.
20+
3. Configure the inputs on **Project Settings > Input System**
21+
22+
## Usage
23+
24+
After installing the package, you can use the custom input system in your project. Here are some examples:
25+
26+
```csharp
27+
using UnityEngine;
28+
using UnityEngine.InputSystem;
29+
30+
public class Example : MonoBehaviour
31+
{
32+
void Update()
33+
{
34+
if (InputSystem.GetButtonDown("Jump"))
35+
{
36+
Debug.Log("Jump button pressed");
37+
}
38+
39+
Vector2 move = InputSystem.GetAxis("Move");
40+
Debug.Log("Move axis: " + move);
41+
}
42+
}

0 commit comments

Comments
 (0)