Skip to content

Commit 6d57445

Browse files
committed
New Input System no longer requires any manual modifications (closed #55)
1 parent 28c046d commit 6d57445

4 files changed

Lines changed: 29 additions & 21 deletions

File tree

.github/README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,6 @@ There are 5 ways to install this plugin:
3737
- *(via [OpenUPM](https://openupm.com))* after installing [openupm-cli](https://github.com/openupm/openupm-cli), run the following command:
3838
- `openupm add com.yasirkula.simplefilebrowser`
3939

40-
### NEW INPUT SYSTEM SUPPORT
41-
42-
This plugin supports Unity's new Input System but it requires some manual modifications (if both the legacy and the new input systems are active at the same time, no changes are needed):
43-
44-
- the plugin mustn't be installed as a package, i.e. it must reside inside the *Assets* folder and not the *Packages* folder (it can reside inside a subfolder of Assets like *Assets/Plugins*)
45-
- if Unity 2019.2.5 or earlier is used, add `ENABLE_INPUT_SYSTEM` compiler directive to **Player Settings/Scripting Define Symbols** (these symbols are platform specific, so if you change the active platform later, you'll have to add the compiler directive again)
46-
- add `Unity.InputSystem` assembly to **SimpleFileBrowser.Runtime** Assembly Definition File's *Assembly Definition References* list
47-
- open *SimpleFileBrowserCanvas* prefab, select *EventSystem* child object and replace *StandaloneInputModule* component with *InputSystemUIInputModule* component (or, if your scene(s) already have EventSystem objects, you can delete SimpleFileBrowserCanvas prefab's EventSystem child object)
48-
4940
## FAQ
5041

5142
- **File browser doesn't show any files on Mac when sandboxing is enabled**
@@ -54,7 +45,7 @@ This is a known issue but I can't give an ETA for a solution at the moment: http
5445

5546
- **File browser doesn't show any files on Android 10+**
5647

57-
File browser uses *Storage Access Framework* on these Android versions and users must first click the *Browse...* button in the quick links section
48+
File browser uses *Storage Access Framework* on these Android versions and users must first click the *Browse...* button in the quick links section.
5849

5950
- **File browser doesn't show any files on Oculus Quest**
6051

@@ -64,6 +55,14 @@ Please see: https://github.com/yasirkula/UnitySimpleFileBrowser/issues/87
6455

6556
Please see: https://github.com/yasirkula/UnitySimpleFileBrowser/issues/70
6657

58+
- **New Input System isn't supported on Unity 2019.2.5 or earlier**
59+
60+
Add `ENABLE_INPUT_SYSTEM` compiler directive to **Player Settings/Scripting Define Symbols** (these symbols are platform specific, so if you change the active platform later, you'll have to add the compiler directive again).
61+
62+
- **"Unity.InputSystem" assembly can't be resolved on Unity 2018.4 or earlier**
63+
64+
Remove `Unity.InputSystem` assembly from **SimpleFileBrowser.Runtime** Assembly Definition File's *Assembly Definition References* list.
65+
6766
- **Android build fails, it says "error: attribute android:requestLegacyExternalStorage not found" in Console**
6867

6968
`android:requestLegacyExternalStorage` attribute in _AndroidManifest.xml_ grants full access to device's storage on Android 10 but requires you to update your Android SDK to at least **SDK 29**. If this isn't possible for you, you should open *SimpleFileBrowser.aar* with WinRAR or 7-Zip and then remove the `<application ... />` tag from _AndroidManifest.xml_.

Plugins/SimpleFileBrowser/README.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,6 @@ File browser comes bundled with two premade skins in the Skins directory: LightS
1616
- By changing the value of FileBrowser.Skin property from a C# script
1717

1818

19-
### NEW INPUT SYSTEM SUPPORT
20-
This plugin supports Unity's new Input System but it requires some manual modifications (if both the legacy and the new input systems are active at the same time, no changes are needed):
21-
22-
- the plugin mustn't be installed as a package, i.e. it must reside inside the Assets folder and not the Packages folder (it can reside inside a subfolder of Assets like Assets/Plugins)
23-
- if Unity 2019.2.5 or earlier is used, add ENABLE_INPUT_SYSTEM compiler directive to "Player Settings/Scripting Define Symbols" (these symbols are platform specific, so if you change the active platform later, you'll have to add the compiler directive again)
24-
- add "Unity.InputSystem" assembly to "SimpleFileBrowser.Runtime" Assembly Definition File's "Assembly Definition References" list
25-
- open SimpleFileBrowserCanvas prefab, select EventSystem child object and replace StandaloneInputModule component with InputSystemUIInputModule component (or, if your scene(s) already have EventSystem objects, you can delete SimpleFileBrowserCanvas prefab's EventSystem child object)
26-
27-
2819
### FAQ
2920
- Android build fails, it says "error: attribute android:requestLegacyExternalStorage not found" in Console
3021
"android:requestLegacyExternalStorage" attribute in AndroidManifest.xml grants full access to device's storage on Android 10 but requires you to update your Android SDK to at least SDK 29. If this isn't possible for you, you should open SimpleFileBrowser.aar with WinRAR or 7-Zip and then remove the "<application ... />" tag from AndroidManifest.xml.

Plugins/SimpleFileBrowser/Scripts/EventSystemHandler.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
using UnityEngine;
22
using UnityEngine.EventSystems;
33
using UnityEngine.SceneManagement;
4+
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
5+
using UnityEngine.InputSystem.UI;
6+
#endif
47

58
namespace SimpleFileBrowser
69
{
@@ -13,6 +16,18 @@ public class EventSystemHandler : MonoBehaviour
1316
private GameObject embeddedEventSystem;
1417
#pragma warning restore 0649
1518

19+
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
20+
private void Awake()
21+
{
22+
StandaloneInputModule legacyInputModule = embeddedEventSystem.GetComponent<StandaloneInputModule>();
23+
if( legacyInputModule )
24+
{
25+
DestroyImmediate( legacyInputModule );
26+
embeddedEventSystem.AddComponent<InputSystemUIInputModule>();
27+
}
28+
}
29+
#endif
30+
1631
private void OnEnable()
1732
{
1833
SceneManager.sceneLoaded -= OnSceneLoaded;
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"name": "SimpleFileBrowser.Runtime"
3-
}
2+
"name": "SimpleFileBrowser.Runtime",
3+
"references": [
4+
"Unity.InputSystem"
5+
]
6+
}

0 commit comments

Comments
 (0)