Skip to content

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanunity committed Nov 9, 2023
2 parents a830638 + 0fd21bc commit f1497f4
Show file tree
Hide file tree
Showing 172 changed files with 4,359 additions and 3,091 deletions.
2 changes: 1 addition & 1 deletion .buginfo
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ system: jira
server: jira.unity3d.com
project: ISXB
issuetype: Bug

package: Input System
10 changes: 6 additions & 4 deletions .yamato/upm-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
commands:
- {{ utr_install_win }}
- {{ upm_ci_install }}
# Get latest version of doctools package. Automatically makes the documentation tests in APIVerification go live.
# Get version 2.3.0-preview of doctools package (it currently fails for 3.0.0-preview).
# Automatically makes the documentation tests in APIVerification go live.
- '%GSUDO% choco install netfx-4.7.1-devpack -y --ignore-detected-reboot --ignore-package-codes'
- git clone [email protected]:unity/com.unity.package-manager-doctools.git Packages/com.unity.package-manager-doctools
- git clone --branch "2.3.0-preview" [email protected]:unity/com.unity.package-manager-doctools.git Packages/com.unity.package-manager-doctools
# We keep the samples in Assets/ as they otherwise won't get imported and you can't
# really work with them. Move them into the package for when we run upm-ci here.
- move /Y .\Assets\Samples .\Packages\com.unity.inputsystem
Expand Down Expand Up @@ -47,8 +48,9 @@
commands:
- {{ utr_install_nix }}
- {{ upm_ci_install }}
# Get latest version of doctools package. Automatically makes the documentation tests in APIVerification go live.
- git clone [email protected]:unity/com.unity.package-manager-doctools.git Packages/com.unity.package-manager-doctools
# Get version 2.3.0-preview of doctools package (it currently fails for 3.0.0-preview).
# Automatically makes the documentation tests in APIVerification go live.
- git clone --branch "2.3.0-preview" [email protected]:unity/com.unity.package-manager-doctools.git Packages/com.unity.package-manager-doctools
# We keep the samples in Assets/ as they otherwise won't get imported and you can't
# really work with them. Move them into the package for when we run upm-ci here.
- mv ./Assets/Samples ./Packages/com.unity.inputsystem
Expand Down
6 changes: 6 additions & 0 deletions Assets/Samples/InGameHints/InGameHintsActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
using UnityEngine;

namespace UnityEngine.InputSystem.Samples.InGameHints
{
Expand Down Expand Up @@ -272,6 +273,11 @@ public @InGameHintsActions()
m_Gameplay_Throw = m_Gameplay.FindAction("Throw", throwIfNotFound: true);
}

~@InGameHintsActions()
{
Debug.Assert(!m_Gameplay.enabled, "This will cause a leak and performance issues, InGameHintsActions.Gameplay.Disable() has not been called.");
}

public void Dispose()
{
UnityEngine.Object.Destroy(asset);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "ProjectWideActionsTest",
"name": "ProjectWideActions",
"rootNamespace": "",
"references": [
"GUID:75469ad4d38634e559750d17036d5f7c"
Expand Down
48 changes: 48 additions & 0 deletions Assets/Samples/ProjectWideActions/ProjectWideActionsExample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS

namespace UnityEngine.InputSystem.Samples.ProjectWideActions
{
public class ProjectWideActionsExample : MonoBehaviour
{
[SerializeField] public GameObject cube;

InputAction move;
InputAction look;
InputAction attack;
InputAction jump;
InputAction interact;
InputAction next;
InputAction previous;
InputAction sprint;
InputAction crouch;

// Start is called before the first frame update
void Start()
{
// Project-Wide Actions
move = InputSystem.actions.FindAction("Player/Move");
look = InputSystem.actions.FindAction("Player/Look");
attack = InputSystem.actions.FindAction("Player/Attack");
jump = InputSystem.actions.FindAction("Player/Jump");
interact = InputSystem.actions.FindAction("Player/Interact");
next = InputSystem.actions.FindAction("Player/Next");
previous = InputSystem.actions.FindAction("Player/Previous");
sprint = InputSystem.actions.FindAction("Player/Sprint");
crouch = InputSystem.actions.FindAction("Player/Crouch");

// Handle input by responding to callbacks
attack.performed += ctx => cube.GetComponent<Renderer>().material.color = Color.red;
attack.canceled += ctx => cube.GetComponent<Renderer>().material.color = Color.green;
}

// Update is called once per frame
void Update()
{
// Handle input by polling each frame
var moveVal = move.ReadValue<Vector2>() * 10.0f * Time.deltaTime;
cube.transform.Translate(new Vector3(moveVal.x, moveVal.y, 0));
}
} // class ProjectWideActionsExample
} // namespace UnityEngine.InputSystem.Samples.ProjectWideActions

#endif
66 changes: 0 additions & 66 deletions Assets/Samples/ProjectWideActionsTest/ProjectWideActionsTest.cs

This file was deleted.

6 changes: 6 additions & 0 deletions Assets/Samples/SimpleDemo/SimpleControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
using UnityEngine;

public partial class @SimpleControls: IInputActionCollection2, IDisposable
{
Expand Down Expand Up @@ -167,6 +168,11 @@ public @SimpleControls()
m_gameplay_look = m_gameplay.FindAction("look", throwIfNotFound: true);
}

~@SimpleControls()
{
Debug.Assert(!m_gameplay.enabled, "This will cause a leak and performance issues, SimpleControls.gameplay.Disable() has not been called.");
}

public void Dispose()
{
UnityEngine.Object.Destroy(asset);
Expand Down
2 changes: 1 addition & 1 deletion Assets/Samples/UnityRemote/UnityRemoteTestScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class UnityRemoteTestScript : MonoBehaviour
{
public Camera camera;
public new Camera camera;

public Text accelerometerInputText;
public Text touchInputText;
Expand Down
4 changes: 2 additions & 2 deletions Assets/Tests/InputSystem.Editor/ControlSchemeEditorTests.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
using NUnit.Framework;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Editor;

Expand Down Expand Up @@ -210,10 +211,9 @@ public void DuplicateControlSchemeCommand_CreatesCopyOfControlSchemeWithUniqueNa
var asset = TestData.inputActionAsset.WithControlScheme(TestData.controlScheme).Generate();
var state = TestData.EditorStateWithAsset(asset).Generate().With(selectedControlScheme: asset.controlSchemes[0]);


state.serializedObject.Update();
var newState = ControlSchemeCommands.DuplicateSelectedControlScheme()(in state);


Assert.That(newState.selectedControlScheme.name, Is.EqualTo(state.selectedControlScheme.name + "1"));
Assert.That(newState.selectedControlScheme.deviceRequirements, Is.EqualTo(state.selectedControlScheme.deviceRequirements));
}
Expand Down
4 changes: 3 additions & 1 deletion Assets/Tests/InputSystem.Editor/SelectorsTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// UITK TreeView is not supported in earlier versions
// Therefore the UITK version of the InputActionAsset Editor is not available on earlier Editor versions either.
#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using UnityEngine;
Expand All @@ -22,7 +24,7 @@ public void GetActionsAsTreeViewData_ReturnsActionsAndBindingsAsTreeViewData()
var actionTwo = actionMap.AddAction("Action2", binding: "<Keyboard>/d");


var treeViewData = Selectors.GetActionsAsTreeViewData(TestData.EditorStateWithAsset(asset).Generate());
var treeViewData = Selectors.GetActionsAsTreeViewData(TestData.EditorStateWithAsset(asset).Generate(), new Dictionary<Guid, int>());


Assert.That(treeViewData.Count, Is.EqualTo(2));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
"defineConstraints": [
"UNITY_INCLUDE_TESTS"
],
"versionDefines": [],
"versionDefines": [
{
"name": "Unity",
"expression": "2022.3",
"define": "UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS"
}
],
"noEngineReferences": false
}
82 changes: 82 additions & 0 deletions Assets/Tests/InputSystem.Editor/XRIPackageTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using System.Collections;
using NUnit.Framework;
using UnityEngine;
using UnityEditor;
using UnityEngine.TestTools;
using UnityEditor.PackageManager;
using UnityEditor.PackageManager.Requests;

// Disable irrelevant warning about there not being underscores in method names.
#pragma warning disable CA1707

public class XRIPackageTests
{
static AddRequest XRAddRequest;
static RemoveRequest XRRemoveRequest;

/// <summary>
/// TearDown removes the added XRI package again.
/// If you are adding a 2nd test that needs the XRI package adjust this.
/// </summary>
/// <returns></returns>
[UnityTearDown]
public IEnumerator TearDown()
{
XRRemoveRequest = Client.Remove("com.unity.xr.interaction.toolkit");
EditorApplication.update += RemoveProgress;
while (!XRRemoveRequest.IsCompleted)
{
yield return null;
}
}

[UnityTest]
[Category("Integration")]
public IEnumerator AdddingLatestXRIPackageThrowsNoErrors()
{
Application.logMessageReceived += HandleLog;

XRAddRequest = Client.Add("com.unity.xr.interaction.toolkit");
EditorApplication.update += AddProgress;

while (!XRAddRequest.IsCompleted)
{
yield return null;
}

AssetDatabase.Refresh();

yield return new WaitForDomainReload();
}

static void AddProgress()
{
if (XRAddRequest.IsCompleted)
{
if (XRAddRequest.Status == StatusCode.Success)
Debug.Log("Installed: " + XRAddRequest.Result.packageId);
else if (XRAddRequest.Status >= StatusCode.Failure)
Debug.Log(XRAddRequest.Error.message);

EditorApplication.update -= AddProgress;
}
}

static void RemoveProgress()
{
if (XRRemoveRequest.IsCompleted)
{
if (XRRemoveRequest.Status == StatusCode.Success)
Debug.Log("Removed: XRI package");
else if (XRRemoveRequest.Status >= StatusCode.Failure)
Debug.Log(XRRemoveRequest.Error.message);

EditorApplication.update -= RemoveProgress;
}
}

void HandleLog(string logString, string stackTrace, LogType type)
{
Assert.That(type, Is.EqualTo(LogType.Log));
}
}
2 changes: 2 additions & 0 deletions Assets/Tests/InputSystem.Editor/XRIPackageTest.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f1497f4

Please sign in to comment.