Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## [1.0.0] - 2020-4-23

### Fixed

- Fixed compilation issues in `TrackedDeviceRaycaster` when disabling built-in XR module.
  • Loading branch information
Unity Technologies committed Apr 22, 2020
1 parent 3096eb5 commit 5da1210
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 16 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
Due to package verification, the latest version below is the unpublished version and the date is meaningless.
however, it has to be formatted properly to pass verification tests.

## [1.0.0] - 2020-4-23

### Fixed

- Fixed compilation issues in `TrackedDeviceRaycaster` when disabling built-in XR module.

## [1.0.0-preview.7] - 2020-04-17

### Fixed
Expand Down
Binary file added Documentation~/Images/EditorRestartWarning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation~/Images/InstallSamples.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Documentation~/Images/ShowPreviewPackages.png
Binary file not shown.
27 changes: 16 additions & 11 deletions Documentation~/Installation.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
# Installation guide

* [Installing the package](#installing-the-package)
* [Enabling the new input backends](#enabling-the-new-input-backends)
* [Installing samples](#installing-samples)

This guide describes how to install and activate the Input System package for your Unity Project.

>__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.
## Installing the package

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__.

![Show Preview Package](Images/ShowPreviewPackages.png)

Select the latest __Input System__ package from the list, then click __Install__.
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__.

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

## Enabling the new input backends

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.
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.

To fully switch from the old Input Manager to the new Input System for a Project:
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.

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

![Switch Active Input Handling](Images/ActiveInputHandling.png)
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.

>__Note__: You must restart the Unity Editor before this setting takes effect.
>**Note:** You can enable __both__ the old __and__ the new system at the same time. To do so, set **Active Input Handling** to **Both**.
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.

## Installing samples

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.

![Install Samples](Images/InstallSamples.png)
1 change: 1 addition & 0 deletions Documentation~/Pen.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ You can query the last used or last added pen with [`Pen.current`](../api/UnityE
>__Note__:
>* Pen/tablet support is currently implemented on Windows, UWP, iOS, and Android. Support on macOS is coming in Unity 2020.1.
>* Some devices support tracking multiple pens independently. Unity's Input System doesn't support this currently.
>* iOS: The double-tap interaction on the side of the Apple Pencil is not surfaced as input at the moment.
## Controls

Expand Down
27 changes: 27 additions & 0 deletions InputSystem/Editor/Internal/EditorHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#if UNITY_EDITOR
using System;
using System.Reflection;
using UnityEditor;
using UnityEditor.VersionControl;

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

public static void RestartEditorAndRecompileScripts(bool dryRun = false)
{
// The APIs here are not public. Use reflection to get to them.

// Delete compilation output.
var editorAssembly = typeof(EditorApplication).Assembly;
var editorCompilationInterfaceType =
editorAssembly.GetType("UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface");
var editorCompilationInstance = editorCompilationInterfaceType.GetProperty("Instance").GetValue(null);
var cleanScriptAssembliesMethod = editorCompilationInstance.GetType().GetMethod("CleanScriptAssemblies");
if (!dryRun)
cleanScriptAssembliesMethod.Invoke(editorCompilationInstance, null);
else if (cleanScriptAssembliesMethod == null)
throw new MissingMethodException(editorCompilationInterfaceType.FullName, "CleanScriptAssemblies");

// Restart editor.
var editorApplicationType = typeof(EditorApplication);
var requestCloseAndRelaunchWithCurrentArgumentsMethod =
editorApplicationType.GetMethod("RequestCloseAndRelaunchWithCurrentArguments",
BindingFlags.NonPublic | BindingFlags.Static);
if (!dryRun)
requestCloseAndRelaunchWithCurrentArgumentsMethod.Invoke(null, null);
else if (requestCloseAndRelaunchWithCurrentArgumentsMethod == null)
throw new MissingMethodException(editorApplicationType.FullName, "RequestCloseAndRelaunchWithCurrentArguments");
}

public static void CheckOut(string path)
{
if (string.IsNullOrEmpty(path))
Expand Down
6 changes: 5 additions & 1 deletion InputSystem/InputSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2941,10 +2941,14 @@ internal static void InitializeInEditor(IInputRuntime runtime = null)
{
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. " +
"This means that no input from native devices will come through." +
"\n\nDo you want to enable the backends? Doing so requires a restart of the editor.";
"\n\nDo you want to enable the backends? Doing so will *RESTART* the editor and will *DISABLE* the old UnityEngine.Input APIs.";

if (EditorUtility.DisplayDialog("Warning", dialogText, "Yes", "No"))
{
EditorPlayerSettingHelpers.newSystemBackendsEnabled = true;
EditorPlayerSettingHelpers.oldSystemBackendsEnabled = false;
EditorHelpers.RestartEditorAndRecompileScripts();
}
}
s_SystemObject.newInputBackendsCheckedAsEnabled = true;

Expand Down
7 changes: 7 additions & 0 deletions InputSystem/Plugins/HID/HID.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
using UnityEngine.InputSystem.Layouts;
using UnityEngine.Scripting;

// HID support is currently broken in 32-bit Windows standalone players. Consider 32bit Windows players unsupported for now.
#if UNITY_STANDALONE_WIN && !UNITY_64
#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.
#endif

////REVIEW: there will probably be lots of cases where the HID device creation process just needs a little tweaking; we should
//// have better mechanism to do that without requiring to replace the entire process wholesale

Expand All @@ -22,6 +27,8 @@

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

////TODO: enable this to handle devices that split their input into multiple reports

#pragma warning disable CS0649, CS0219
namespace UnityEngine.InputSystem.HID
{
Expand Down
2 changes: 2 additions & 0 deletions InputSystem/Plugins/OnScreen/OnScreenControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

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

////TODO: handle display strings for this in some form; shouldn't display generic gamepad binding strings, for example, for OSCs

////TODO: give more control over when an OSC creates a new devices; going simply by name of layout only is inflexible

////TODO: make this survive domain reloads
Expand Down
5 changes: 5 additions & 0 deletions InputSystem/Plugins/PlayerInput/PlayerInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
using UnityEngine.InputSystem.UI;
#endif

////TODO: when joining is *off*, allow auto-switching even in multiplayer

////TODO: differentiate not only by already paired devices but rather take control schemes into account; allow two players to be on the same
//// device as long as they are using different control schemes

////TODO: allow PlayerInput to be set up in a way where it's in an unpaired/non-functional state and expects additional configuration

////REVIEW: having everything coupled to component enable/disable is quite restrictive; can we allow PlayerInputs
Expand Down
2 changes: 1 addition & 1 deletion InputSystem/Plugins/UI/TrackedDeviceRaycaster.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if PACKAGE_DOCS_GENERATION || (UNITY_INPUT_SYSTEM_ENABLE_UI && UNITY_INPUT_SYSTEM_ENABLE_XR)
#if PACKAGE_DOCS_GENERATION || UNITY_INPUT_SYSTEM_ENABLE_UI
using System;
using System.Collections.Generic;
using UnityEngine.EventSystems;
Expand Down
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"name": "com.unity.inputsystem",
"displayName": "Input System",
"version": "1.0.0-preview.7",
"version": "1.0.0",
"unity": "2019.1",
"repository": {
"footprint": "ed04a58c1789ae2f34a9d29017aee30604fb1e32",
"type": "git",
"url": "https://github.com/Unity-Technologies/InputSystem.git",
"revision": "dc14c49beb7e3577bbf5f731cc0244cfe70b17a3"
"revision": "0617549352dbfae87698b044d343b97727dd6581"
},
"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.",
"keywords": [
Expand All @@ -20,6 +19,9 @@
"vr",
"xr"
],
"upmCi": {
"footprint": "f6129c6fd91afee16e3739ad949e5e38c7bd908e"
},
"samples": [
{
"displayName": "Custom Binding Composite",
Expand Down

0 comments on commit 5da1210

Please sign in to comment.