Skip to content

Commit 0617549

Browse files
author
Rene Damm
committed
MERGE: develop => stable.
2 parents dc14c49 + 41b8f70 commit 0617549

File tree

14 files changed

+79
-15
lines changed

14 files changed

+79
-15
lines changed

Assets/Tests/InputSystem/CoreTests_Editor.cs

+7
Original file line numberDiff line numberDiff line change
@@ -2313,6 +2313,13 @@ public void Editor_LeavingPlayMode_DestroysAllActionStates()
23132313
Assert.That(InputSystem.s_Manager.m_StateChangeMonitors[0].listeners[0].control, Is.Null); // Won't get removed, just cleared.
23142314
}
23152315

2316+
[Test]
2317+
[Category("Editor")]
2318+
public void Editor_CanRestartEditorThroughReflection()
2319+
{
2320+
EditorHelpers.RestartEditorAndRecompileScripts(dryRun: true);
2321+
}
2322+
23162323
////TODO: tests for InputAssetImporter; for this we need C# mocks to be able to cut us off from the actual asset DB
23172324
}
23182325
#endif // UNITY_EDITOR

Packages/com.unity.inputsystem/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
Due to package verification, the latest version below is the unpublished version and the date is meaningless.
88
however, it has to be formatted properly to pass verification tests.
99

10+
## [1.0.0] - 2020-4-23
11+
12+
### Fixed
13+
14+
- Fixed compilation issues in `TrackedDeviceRaycaster` when disabling built-in XR module.
15+
1016
## [1.0.0-preview.7] - 2020-04-17
1117

1218
### Fixed
Loading
Loading
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,35 @@
11
# Installation guide
22

3+
* [Installing the package](#installing-the-package)
4+
* [Enabling the new input backends](#enabling-the-new-input-backends)
5+
* [Installing samples](#installing-samples)
6+
37
This guide describes how to install and activate the Input System package for your Unity Project.
48

59
>__Note__: The new Input System requires Unity 2019.1+ and the .NET 4 runtime. It doesn't work in projects using the old .NET 3.5 runtime.
610
711
## Installing the package
812

9-
To install the new Input System, open Unity's package manager (menu: __Window > Package Manager__). The Input System is in Preview, so to see the package in the package list, select the __Advanced__ dropdown, and enable __Show Preview Packages__.
10-
11-
![Show Preview Package](Images/ShowPreviewPackages.png)
12-
13-
Select the latest __Input System__ package from the list, then click __Install__.
13+
To install the new Input System, open Unity's package manager (menu: __Window > Package Manager__). Select the __Input System__ package from the list, then click __Install__.
1414

1515
![Install Input System Package](Images/InputSystemPackage.png)
1616

1717
## Enabling the new input backends
1818

19-
By default, Unity's classic Input Manager is active and support for the new Input System is inactive. This allows existing Unity Projects to keep working as they are.
19+
By default, Unity's classic Input Manager (`UnityEngine.Input`) is active and support for the new Input System is inactive. This allows existing Unity Projects to keep working as they are.
2020

21-
To fully switch from the old Input Manager to the new Input System for a Project:
21+
When you install the Input System package, Unity will ask whether you want to enable the new backends. If you click **Yes**, Unity will enable the new backends and disable the old backends, and the Editor will restart.
2222

23-
1. Open the Player settings (menu: __Edit > Project Settings > Player__).
24-
2. Change Active Input Handling to __Input System Package (New)__ (or __Input System (Preview)__ in Unity 2019.2 or older).
23+
![Editor Restart Warning](Images/EditorRestartWarning.png)
2524

26-
![Switch Active Input Handling](Images/ActiveInputHandling.png)
25+
You can find the corresponding setting in the Player settings (menu: __Edit > Project Settings > Player__), under **Active Input Handling**. You can change this setting at any time. Doing so will restart the Editor.
2726

28-
>__Note__: You must restart the Unity Editor before this setting takes effect.
27+
>**Note:** You can enable __both__ the old __and__ the new system at the same time. To do so, set **Active Input Handling** to **Both**.
2928
3029
When the new input backends are enabled, the `ENABLE_INPUT_SYSTEM=1` C# `#define` is added to builds. Similarly, when the old input backends are enabled, the `ENABLE_LEGACY_INPUT_MANAGER=1` C# `#define` is added. Because both can be enabled at the same time, it is possible for __both__ defines to be 1 at the same time.
30+
31+
## Installing samples
32+
33+
The Input System package comes with a number of samples. You can install these directly from the Package Manager window in Unity (menu: __Window > Package Manager__). To see the list, select the Input System package in the Package Manager window. Click **Import into Project** next to a sample to copy it into the current Project.
34+
35+
![Install Samples](Images/InstallSamples.png)

Packages/com.unity.inputsystem/Documentation~/Pen.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ You can query the last used or last added pen with [`Pen.current`](../api/UnityE
1111
>__Note__:
1212
>* Pen/tablet support is currently implemented on Windows, UWP, iOS, and Android. Support on macOS is coming in Unity 2020.1.
1313
>* Some devices support tracking multiple pens independently. Unity's Input System doesn't support this currently.
14+
>* iOS: The double-tap interaction on the side of the Apple Pencil is not surfaced as input at the moment.
1415
1516
## Controls
1617

Packages/com.unity.inputsystem/InputSystem/Editor/Internal/EditorHelpers.cs

+27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#if UNITY_EDITOR
22
using System;
3+
using System.Reflection;
34
using UnityEditor;
45
using UnityEditor.VersionControl;
56

@@ -10,6 +11,32 @@ internal static class EditorHelpers
1011
public static Action<string> SetSystemCopyBufferContents = s => EditorGUIUtility.systemCopyBuffer = s;
1112
public static Func<string> GetSystemCopyBufferContents = () => EditorGUIUtility.systemCopyBuffer;
1213

14+
public static void RestartEditorAndRecompileScripts(bool dryRun = false)
15+
{
16+
// The APIs here are not public. Use reflection to get to them.
17+
18+
// Delete compilation output.
19+
var editorAssembly = typeof(EditorApplication).Assembly;
20+
var editorCompilationInterfaceType =
21+
editorAssembly.GetType("UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface");
22+
var editorCompilationInstance = editorCompilationInterfaceType.GetProperty("Instance").GetValue(null);
23+
var cleanScriptAssembliesMethod = editorCompilationInstance.GetType().GetMethod("CleanScriptAssemblies");
24+
if (!dryRun)
25+
cleanScriptAssembliesMethod.Invoke(editorCompilationInstance, null);
26+
else if (cleanScriptAssembliesMethod == null)
27+
throw new MissingMethodException(editorCompilationInterfaceType.FullName, "CleanScriptAssemblies");
28+
29+
// Restart editor.
30+
var editorApplicationType = typeof(EditorApplication);
31+
var requestCloseAndRelaunchWithCurrentArgumentsMethod =
32+
editorApplicationType.GetMethod("RequestCloseAndRelaunchWithCurrentArguments",
33+
BindingFlags.NonPublic | BindingFlags.Static);
34+
if (!dryRun)
35+
requestCloseAndRelaunchWithCurrentArgumentsMethod.Invoke(null, null);
36+
else if (requestCloseAndRelaunchWithCurrentArgumentsMethod == null)
37+
throw new MissingMethodException(editorApplicationType.FullName, "RequestCloseAndRelaunchWithCurrentArguments");
38+
}
39+
1340
public static void CheckOut(string path)
1441
{
1542
if (string.IsNullOrEmpty(path))

Packages/com.unity.inputsystem/InputSystem/InputSystem.cs

+5-1
Original file line numberDiff line numberDiff line change
@@ -2941,10 +2941,14 @@ internal static void InitializeInEditor(IInputRuntime runtime = null)
29412941
{
29422942
const string dialogText = "This project is using the new input system package but the native platform backends for the new input system are not enabled in the player settings. " +
29432943
"This means that no input from native devices will come through." +
2944-
"\n\nDo you want to enable the backends? Doing so requires a restart of the editor.";
2944+
"\n\nDo you want to enable the backends? Doing so will *RESTART* the editor and will *DISABLE* the old UnityEngine.Input APIs.";
29452945

29462946
if (EditorUtility.DisplayDialog("Warning", dialogText, "Yes", "No"))
2947+
{
29472948
EditorPlayerSettingHelpers.newSystemBackendsEnabled = true;
2949+
EditorPlayerSettingHelpers.oldSystemBackendsEnabled = false;
2950+
EditorHelpers.RestartEditorAndRecompileScripts();
2951+
}
29482952
}
29492953
s_SystemObject.newInputBackendsCheckedAsEnabled = true;
29502954

Packages/com.unity.inputsystem/InputSystem/Plugins/HID/HID.cs

+7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
using UnityEngine.InputSystem.Layouts;
1010
using UnityEngine.Scripting;
1111

12+
// HID support is currently broken in 32-bit Windows standalone players. Consider 32bit Windows players unsupported for now.
13+
#if UNITY_STANDALONE_WIN && !UNITY_64
14+
#warning The 32-bit Windows player is not currently supported by the Input System. HID input will not work in the player. Please use x86_64, if possible.
15+
#endif
16+
1217
////REVIEW: there will probably be lots of cases where the HID device creation process just needs a little tweaking; we should
1318
//// have better mechanism to do that without requiring to replace the entire process wholesale
1419

@@ -22,6 +27,8 @@
2227

2328
////TODO: add a way to mark certain layouts (such as HID layouts) as fallbacks; ideally, affect the layout matching score
2429

30+
////TODO: enable this to handle devices that split their input into multiple reports
31+
2532
#pragma warning disable CS0649, CS0219
2633
namespace UnityEngine.InputSystem.HID
2734
{

Packages/com.unity.inputsystem/InputSystem/Plugins/OnScreen/OnScreenControl.cs

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
////REVIEW: should we make this ExecuteInEditMode?
88

9+
////TODO: handle display strings for this in some form; shouldn't display generic gamepad binding strings, for example, for OSCs
10+
911
////TODO: give more control over when an OSC creates a new devices; going simply by name of layout only is inflexible
1012

1113
////TODO: make this survive domain reloads

Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
using UnityEngine.InputSystem.UI;
1010
#endif
1111

12+
////TODO: when joining is *off*, allow auto-switching even in multiplayer
13+
14+
////TODO: differentiate not only by already paired devices but rather take control schemes into account; allow two players to be on the same
15+
//// device as long as they are using different control schemes
16+
1217
////TODO: allow PlayerInput to be set up in a way where it's in an unpaired/non-functional state and expects additional configuration
1318

1419
////REVIEW: having everything coupled to component enable/disable is quite restrictive; can we allow PlayerInputs

Packages/com.unity.inputsystem/InputSystem/Plugins/UI/TrackedDeviceRaycaster.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if PACKAGE_DOCS_GENERATION || (UNITY_INPUT_SYSTEM_ENABLE_UI && UNITY_INPUT_SYSTEM_ENABLE_XR)
1+
#if PACKAGE_DOCS_GENERATION || UNITY_INPUT_SYSTEM_ENABLE_UI
22
using System;
33
using System.Collections.Generic;
44
using UnityEngine.EventSystems;

Packages/com.unity.inputsystem/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "com.unity.inputsystem",
33
"displayName": "Input System",
4-
"version": "1.0.0-preview.7",
4+
"version": "1.0.0",
55
"unity": "2019.1",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/Unity-Technologies/InputSystem.git",
9-
"revision": "c884fdf1f6b670fc507e02c9596c3c3c1adc2367"
9+
"revision": "10594b974d033e4f17f8cebdd851a7d818c33ff1"
1010
},
1111
"description": "A new input system which can be used as a more extensible and customizable alternative to Unity's classic input system in UnityEngine.Input.",
1212
"keywords": [

0 commit comments

Comments
 (0)