FIX: iOSStepCounter and many others being stripped on mid/high stripping levels of managed linker (#1418)

Co-authored-by: Tomas Dirvanauskas <tomas@unity3d.com>
Co-authored-by: Dmytro Ivanov <dmytro@unity3d.com>
This commit is contained in:
Dmytro Ivanov 2021-10-13 14:57:55 +02:00 коммит произвёл GitHub
Родитель b6e0a3a565
Коммит f7e378ad8e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
92 изменённых файлов: 153 добавлений и 374 удалений

Просмотреть файл

@ -156,22 +156,6 @@ class APIVerificationTests
Assert.That(intptrMethods, Is.Empty);
}
[Test]
[Category("API")]
[TestCase(typeof(InputControl))]
[TestCase(typeof(IInputInteraction))]
[TestCase(typeof(InputBindingComposite))]
[TestCase(typeof(InputProcessor))]
public void API_TypesCreatedByReflectionHavePreserveAttribute(Type type)
{
var types = type.Assembly.GetTypes().Where(t => type.IsAssignableFrom(t)).Concat(typeof(APIVerificationTests).Assembly.GetTypes().Where(t => type.IsAssignableFrom(t)));
Assert.That(types, Is.Not.Empty);
var typesWithoutPreserveAttribute =
types.Where(t => !t.CustomAttributes.Any(a => a.AttributeType.Name.Contains("PreserveAttribute")))
.Where(t => !IgnoreTypeWithoutPreserveAttribute(t));
Assert.That(typesWithoutPreserveAttribute, Is.Empty);
}
[Test]
[Category("API")]
public void API_MethodParameterTypesAreNotIntPtr()
@ -427,23 +411,6 @@ class APIVerificationTests
return false;
}
private bool IgnoreTypeWithoutPreserveAttribute(Type type)
{
// Precompiled layouts are not created through reflection and thus don't need [Preserve].
if (type == typeof(FastKeyboard)
|| type == typeof(FastMouse)
|| type == typeof(FastTouchscreen)
|| type == typeof(FastDualShock4GamepadHID)
#if UNITY_EDITOR || UNITY_IOS || UNITY_TVOS
// iOS Step Counter is created from C# code
|| type == typeof(iOSStepCounter)
#endif
)
return true;
return false;
}
#if HAVE_DOCTOOLS_INSTALLED
////TODO: move this to a fixture setup so that it runs *once* for all API checks in a test run
private static string GenerateDocsDirectory(out string log)

Просмотреть файл

@ -2096,7 +2096,6 @@ partial class CoreTests
}
}
[Preserve]
private class ReleaseOnlyTestInteraction : IInputInteraction<float>
{
private bool m_WaitingForRelease;
@ -3465,7 +3464,6 @@ partial class CoreTests
}
// ReSharper disable once ClassNeverInstantiated.Local
[Preserve]
private class ConstantVector2TestProcessor : InputProcessor<Vector2>
{
public override Vector2 Process(Vector2 value, InputControl control)
@ -3948,7 +3946,6 @@ partial class CoreTests
}
// ReSharper disable once ClassNeverInstantiated.Local
[Preserve]
private class TestInteraction : IInputInteraction
{
#pragma warning disable CS0649
@ -6287,7 +6284,6 @@ partial class CoreTests
#endif // UNITY_EDITOR
#pragma warning disable CS0649
[Preserve]
private class CompositeWithParameters : InputBindingComposite<float>
{
public int intParameter;
@ -6868,7 +6864,6 @@ partial class CoreTests
}
}
[Preserve]
private class LogInteraction : IInputInteraction
{
public void Process(ref InputInteractionContext context)
@ -7254,7 +7249,6 @@ partial class CoreTests
LogAssert.NoUnexpectedReceived();
}
[Preserve]
private class CompositeWithVector2Part : InputBindingComposite<Vector2>
{
[InputControlAttribute(layout = "Vector2")]
@ -7288,7 +7282,6 @@ partial class CoreTests
}
}
[Preserve]
private class CompositeAskingForSourceControl : InputBindingComposite<float>
{
[InputControl(layout = "Button")]
@ -8351,7 +8344,6 @@ partial class CoreTests
LogAssert.NoUnexpectedReceived();
}
[Preserve]
class TestInteractionCheckingDefaultState : IInputInteraction
{
public void Process(ref InputInteractionContext context)

Просмотреть файл

@ -92,7 +92,6 @@ internal partial class CoreTests
Assert.That(multiTapAction.GetTimeoutCompletionPercentage(), Is.EqualTo(1).Within(0.0001));
}
[Preserve]
class InteractionThatOnlyPerforms : IInputInteraction<float>
{
// Get rid of unused field warning.
@ -743,7 +742,6 @@ internal partial class CoreTests
}
}
[Preserve]
private class CancelingTestInteraction : IInputInteraction
{
public void Process(ref InputInteractionContext context)

Просмотреть файл

@ -1144,7 +1144,6 @@ partial class CoreTests
Assert.That(InputControlPath.ToHumanReadableString("<Keyboard>/a", control: Keyboard.current), Is.EqualTo("Q [Keyboard]"));
}
[Preserve]
private class DeviceWithoutAnyControls : InputDevice
{
}

Просмотреть файл

@ -587,7 +587,6 @@ partial class CoreTests
Assert.That(InputSystem.s_Manager.updateMask & InputUpdateType.BeforeRender, Is.EqualTo((InputUpdateType)0));
}
[Preserve]
private class TestDeviceReceivingAddAndRemoveNotification : Mouse
{
public int addedCount;
@ -1019,7 +1018,6 @@ partial class CoreTests
Assert.That(receivedEventPtr.IsA<StateEvent>(), Is.True);
}
[Preserve]
private class TestDeviceThatResetsStateInCallback : InputDevice, IInputStateCallbackReceiver
{
[InputControl(format = "FLT")]
@ -1112,7 +1110,6 @@ partial class CoreTests
}
[InputControlLayout(stateType = typeof(TestDeviceFullState))]
[Preserve]
private class TestDeviceIntegratingStateItself : InputDevice, IInputStateCallbackReceiver
{
public void OnNextUpdate()
@ -5295,7 +5292,6 @@ partial class CoreTests
}
[InputControlLayout(stateType = typeof(PreProcessorTestDeviceState))]
[Preserve]
public class PreProcessorTestDevice : InputDevice, IEventPreProcessor
{
public enum Behavior

Просмотреть файл

@ -2238,7 +2238,6 @@ partial class CoreTests
Assert.That(InputProcessor.GetValueTypeFromType(typeof(ScaleProcessor)), Is.SameAs(typeof(float)));
}
[Preserve]
private class TestInteractionWithValueType : IInputInteraction<float>
{
public void Process(ref InputInteractionContext context)

Просмотреть файл

@ -918,7 +918,6 @@ partial class CoreTests
}
[InputControlLayout(stateType = typeof(DpadState))]
[Preserve]
private class DpadDevice : InputDevice
{
}
@ -1193,7 +1192,6 @@ partial class CoreTests
}
[InputControlLayout(stateType = typeof(StateWith2Bytes))]
[Preserve]
class DeviceWith2ByteState : InputDevice
{
}
@ -1959,7 +1957,6 @@ partial class CoreTests
}
[InputControlLayout(stateType = typeof(CustomDeviceState))]
[Preserve]
private class CustomDevice : InputDevice
{
public AxisControl axis { get; private set; }
@ -1972,7 +1969,6 @@ partial class CoreTests
}
[InputControlLayout(stateType = typeof(CustomDeviceState))]
[Preserve]
private class CustomDeviceWithUpdate : CustomDevice, IInputUpdateCallbackReceiver
{
public int onUpdateCallCount;
@ -2424,7 +2420,6 @@ partial class CoreTests
}
[InputControlLayout(stateType = typeof(ThrowingExceptionTestDeviceState))]
[Preserve]
private class ThrowingExceptionTestDevice : InputDevice, IInputStateCallbackReceiver
{
public class TestException : Exception

Просмотреть файл

@ -237,10 +237,8 @@ partial class CoreTests
Assert.That(layout["hexDigital"].defaultState.ToInt64(), Is.EqualTo(0x1234));
}
[Preserve]
class TestDeviceWithDefaultState : InputDevice
{
[Preserve]
[InputControl(defaultState = 0.1234)]
public AxisControl control { get; set; }
}
@ -373,7 +371,6 @@ partial class CoreTests
}
[InputControlLayout(stateType = typeof(StateStructWithArrayOfControls))]
[Preserve]
private class TestDeviceWithArrayOfControls : InputDevice
{
}
@ -451,7 +448,6 @@ partial class CoreTests
}
[InputControlLayout(commonUsages = new[] {"LeftHand", "RightHand"})]
[Preserve]
private class DeviceWithCommonUsages : InputDevice
{
}
@ -691,14 +687,12 @@ partial class CoreTests
#endif
}
[Preserve]
private class TestDevice : InputDevice
{
[InputControl(processors = "Invert")]
public ButtonControl button { get; set; }
}
[Preserve]
private class PrecompiledTestDevice : TestDevice
{
public PrecompiledTestDevice()
@ -744,7 +738,6 @@ partial class CoreTests
}
";
[Preserve]
public class CustomInvertProcessor : InputProcessor<float>
{
public override float Process(float value, InputControl control)
@ -1185,7 +1178,6 @@ partial class CoreTests
Assert.That(newDevice.description, Is.EqualTo(oldDeviceDescription));
}
[Preserve]
private class MyButtonControl : ButtonControl
{
}
@ -1256,7 +1248,6 @@ partial class CoreTests
Assert.Fail();
}
[Preserve]
private class TestLayoutType : Pointer
{
}
@ -1272,11 +1263,9 @@ partial class CoreTests
Assert.That(layout.baseLayouts, Is.EquivalentTo(new[] {new InternedString("Pointer")}));
}
[Preserve]
class DeviceWithControlProperties : InputDevice
{
public ButtonControl propertyWithoutAttribute { get; set; }
[Preserve]
[InputControl]
public ButtonControl propertyWithAttribute { get; set; }
}
@ -1351,7 +1340,6 @@ partial class CoreTests
}
[InputControlLayout(stateType = typeof(StateStructWithPrimitiveFields))]
[Preserve]
private class DeviceWithStateStructWithPrimitiveFields : InputDevice
{
}
@ -1377,7 +1365,6 @@ partial class CoreTests
}
[InputControlLayout(stateType = typeof(StateWithFixedArray))]
[Preserve]
private class DeviceWithStateStructWithFixedArray : InputDevice
{
}
@ -1655,10 +1642,8 @@ partial class CoreTests
Assert.That(device.leftStick.x.shortDisplayName, Is.EqualTo("PS Horizontal"));
}
[Preserve]
class TestDeviceWithMinMaxValue : InputDevice
{
[Preserve]
[InputControl(minValue = 0.1234f, maxValue = 0.5432f)]
public AxisControl control { get; set; }
}
@ -1704,20 +1689,16 @@ partial class CoreTests
Assert.That(layout["control"].maxValue.ToInt32(), Is.EqualTo(123));
}
[Preserve]
class BaseClassWithControl : InputDevice
{
[Preserve]
[InputControl]
public AxisControl controlFromBase { get; set; }
}
[Preserve]
class DerivedClassModifyingControlFromBaseClass : BaseClassWithControl
{
// One kink is that InputControlAttribute can only go on fields and properties
// so we have to put it on some unrelated control.
[Preserve]
[InputControl(name = "controlFromBase", format = "SHRT")]
public ButtonControl controlFromDerived { get; set; }
}
@ -1885,14 +1866,11 @@ partial class CoreTests
Assert.That(device["button"].synthetic, Is.True);
}
[Preserve]
class DeviceWithAutoOffsetControl : InputDevice
{
[Preserve]
[InputControl(offset = 4, sizeInBits = 32)]
public ButtonControl button1;
[Preserve]
[InputControl(offset = InputStateBlock.AutomaticOffset)]
public ButtonControl button2 { get; set; }
}
@ -1906,22 +1884,17 @@ partial class CoreTests
Assert.That(device["button2"].stateBlock.byteOffset, Is.EqualTo(8));
}
[Preserve]
private class BaseDeviceFixedFixedOffsetControl : InputDevice
{
[Preserve]
[InputControl(offset = 4, format = "FLT")]
public ButtonControl control;
[Preserve]
[InputControl(offset = 8)]
public AxisControl otherControl;
}
[Preserve]
private class DerivedDeviceWithAutomaticOffsetControl : BaseDeviceFixedFixedOffsetControl
{
[Preserve]
[InputControl(offset = InputStateBlock.AutomaticOffset)]
public new ButtonControl control;
}
@ -1985,15 +1958,12 @@ partial class CoreTests
Assert.That(device["fourth"].stateBlock.sizeInBits, Is.EqualTo(1));
}
[Preserve]
private class DeviceWithMisalignedAutomaticControl : InputDevice
{
[Preserve]
[InputControl(offset = 0, sizeInBits = 8)]
public AxisControl control1;
// 4-byte control. Must be aligned to 4 bytes.
[Preserve]
[InputControl(offset = InputStateBlock.AutomaticOffset, sizeInBits = 32)]
public AxisControl control2;
}
@ -2307,13 +2277,11 @@ partial class CoreTests
}
[InputControlLayout(variants = "A", stateType = typeof(StateWithTwoLayoutVariants))]
[Preserve]
private class DeviceWithLayoutVariantA : InputDevice
{
}
[InputControlLayout(variants = "B", stateType = typeof(StateWithTwoLayoutVariants))]
[Preserve]
private class DeviceWithLayoutVariantB : InputDevice
{
}
@ -2591,7 +2559,6 @@ partial class CoreTests
}
[InputControlLayout(stateType = typeof(BaseInputState))]
[Preserve]
private class BaseInputDevice : InputDevice
{
}
@ -2602,7 +2569,6 @@ partial class CoreTests
}
[InputControlLayout(stateType = typeof(DerivedInputState))]
[Preserve]
private class DerivedInputDevice : InputDevice
{
}

Просмотреть файл

@ -528,7 +528,6 @@ partial class CoreTests
}
}
[Preserve]
private class MyDevice : InputDevice
{
public ButtonControl myControl { get; private set; }

Просмотреть файл

@ -706,7 +706,6 @@ partial class CoreTests
}
[InputControlLayout(stateType = typeof(StateWithMultiBitControl))]
[Preserve]
private class TestDeviceWithMultiBitControl : InputDevice
{
}

Просмотреть файл

@ -378,7 +378,6 @@ internal class SteamTests : CoreTestsFixture
}
[InputControlLayout(stateType = typeof(TestControllerState))]
[Preserve]
class TestController : SteamController
{
public ButtonControl fire { get; private set; }

Просмотреть файл

@ -327,7 +327,6 @@ internal class XRTests : CoreTestsFixture
}
[InputControlLayout(updateBeforeRender = true)]
[Preserve]
private class TestHMD : UnityEngine.InputSystem.InputDevice
{
[InputControl]

Просмотреть файл

@ -23,6 +23,7 @@ however, it has to be formatted properly to pass verification tests.
- Fixed a problem where only using runtimes that are not XR supported causes a compile error.This fix adds back in ENABLE_VR checks to prevent this case (case 1368300)
- Fixed input action for Android gamepad's right stick will be correctly invoked when only y axis is changing ([case 1308637](https://issuetracker.unity3d.com/issues/android-input-system-right-analog-stick-tracking-is-erratic-when-using-a-gamepad-connected-to-an-android-device)).
- Generic gamepad short display button names where incorrectly mapped on Switch (`A` instead of `B`, etc).
- Fixed "Default constructor not found for type UnityEngine.InputSystem.iOS.LowLevel.iOSStepCounter" any other potential exceptions due to classes, methods, fields and properties being stripped when managed stripping setting set to medium or high ([case 1368761](https://issuetracker.unity3d.com/issues/ios-new-input-system-iosstepcounter-crash-on-launch-with-managed-stripping)).
### Added

Просмотреть файл

@ -41,7 +41,6 @@ namespace UnityEngine.InputSystem.Composites
/// and inverted for <see cref="negative"/>. This means that if the buttons are actual axes (e.g.
/// the triggers on gamepads), then the values correspond to how much the axis is actuated.
/// </remarks>
[Preserve]
[DisplayStringFormat("{negative}/{positive}")]
[DisplayName("Positive/Negative Binding")]
public class AxisComposite : InputBindingComposite<float>

Просмотреть файл

@ -45,7 +45,6 @@ namespace UnityEngine.InputSystem.Composites
/// </example>
/// </remarks>
/// <seealso cref="ButtonWithTwoModifiers"/>
[Preserve]
[DesignTimeVisible(false)] // Obsoleted by OneModifierComposite
[DisplayStringFormat("{modifier}+{button}")]
public class ButtonWithOneModifier : InputBindingComposite<float>

Просмотреть файл

@ -48,7 +48,6 @@ namespace UnityEngine.InputSystem.Composites
/// </example>
/// </remarks>
/// <seealso cref="ButtonWithOneModifier"/>
[Preserve]
[DesignTimeVisible(false)] // Obsoleted by TwoModifiersComposite
[DisplayStringFormat("{modifier1}+{modifier2}+{button}")]
public class ButtonWithTwoModifiers : InputBindingComposite<float>

Просмотреть файл

@ -43,7 +43,6 @@ namespace UnityEngine.InputSystem.Composites
/// </example>
/// </remarks>
/// <seealso cref="TwoModifiersComposite"/>
[Preserve]
[DisplayStringFormat("{modifier}+{binding}")]
[DisplayName("Binding With One Modifier")]
public class OneModifierComposite : InputBindingComposite

Просмотреть файл

@ -55,7 +55,6 @@ namespace UnityEngine.InputSystem.Composites
/// </example>
/// </remarks>
/// <seealso cref="OneModifierComposite"/>
[Preserve]
[DisplayStringFormat("{modifier1}+{modifier2}+{binding}")]
[DisplayName("Binding With Two Modifiers")]
public class TwoModifiersComposite : InputBindingComposite

Просмотреть файл

@ -39,7 +39,6 @@ namespace UnityEngine.InputSystem.Composites
/// </example>
/// </remarks>
/// <seealso cref="Vector3Composite"/>
[Preserve]
[DisplayStringFormat("{up}/{left}/{down}/{right}")] // This results in WASD.
[DisplayName("Up/Down/Left/Right Composite")]
public class Vector2Composite : InputBindingComposite<Vector2>

Просмотреть файл

@ -31,7 +31,6 @@ namespace UnityEngine.InputSystem.Composites
/// </example>
/// </remarks>
/// <seealso cref="Vector2Composite"/>
[Preserve]
[DisplayStringFormat("{up}+{down}/{left}+{right}/{forward}+{backward}")]
[DisplayName("Up/Down/Left/Right/Forward/Backward Composite")]
public class Vector3Composite : InputBindingComposite<Vector3>

Просмотреть файл

@ -185,7 +185,6 @@ namespace UnityEngine.InputSystem
/// <seealso cref="InputBinding.interactions"/>
/// <seealso cref="InputAction.interactions"/>
/// <seealso cref="Editor.InputParameterEditor"/>
[Preserve]
public interface IInputInteraction
{
/// <summary>
@ -288,7 +287,6 @@ namespace UnityEngine.InputSystem
/// In all other ways, this interface is identical to <see cref="IInputInteraction"/>.
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces", Justification = "This interface is used to mark implementing classes to advertise the value it expects. This seems more elegant then the suggestion to use an attribute.")]
[Preserve]
public interface IInputInteraction<TValue> : IInputInteraction
where TValue : struct
{

Просмотреть файл

@ -26,7 +26,6 @@ namespace UnityEngine.InputSystem
/// for more details about composites and for how to define custom composites.
/// </remarks>
/// <seealso cref="InputSystem.RegisterBindingComposite{T}"/>
[Preserve]
public abstract class InputBindingComposite
{
/// <summary>
@ -284,7 +283,6 @@ namespace UnityEngine.InputSystem
/// of how to create a custom composite.
/// </remarks>
/// <seealso cref="InputSystem.RegisterBindingComposite{T}"/>
[Preserve]
public abstract class InputBindingComposite<TValue> : InputBindingComposite
where TValue : struct
{

Просмотреть файл

@ -24,7 +24,6 @@ namespace UnityEngine.InputSystem.Interactions
/// </code>
/// </example>
/// </remarks>
[Preserve]
[DisplayName("Hold")]
public class HoldInteraction : IInputInteraction
{

Просмотреть файл

@ -25,7 +25,6 @@ namespace UnityEngine.InputSystem.Interactions
/// <see cref="InputActionPhase.Performed"/>) or the multi-tap is aborted by a timeout being hit (in which
/// case the interaction will trigger <see cref="InputActionPhase.Canceled"/>).
/// </remarks>
[Preserve]
public class MultiTapInteraction : IInputInteraction<float>
{
/// <summary>

Просмотреть файл

@ -31,7 +31,6 @@ namespace UnityEngine.InputSystem.Interactions
/// (<see cref="UnityEngine.InputSystem.Controls.ButtonControl"/>) corresponds to using a press modifier with <see cref="behavior"/>
/// set to <see cref="PressBehavior.PressOnly"/> and <see cref="pressPoint"/> left at default.
/// </remarks>
[Preserve]
[DisplayName("Press")]
public class PressInteraction : IInputInteraction
{

Просмотреть файл

@ -14,7 +14,6 @@ namespace UnityEngine.InputSystem.Interactions
/// duration (which defaults to <see cref="InputSettings.defaultSlowTapTime"/>)
/// and then released.
/// </summary>
[Preserve]
[DisplayName("Long Tap")]
public class SlowTapInteraction : IInputInteraction
{

Просмотреть файл

@ -12,7 +12,6 @@ namespace UnityEngine.InputSystem.Interactions
/// duration (which defaults to <see cref="InputSettings.defaultTapTime"/>)
/// and then released.
/// </summary>
[Preserve]
[DisplayName("Tap")]
public class TapInteraction : IInputInteraction
{

Просмотреть файл

@ -16,7 +16,6 @@ namespace UnityEngine.InputSystem.Controls
/// </remarks>
/// <seealso cref="Keyboard.anyKey"/>
[InputControlLayout(hideInUI = true)]
[Scripting.Preserve]
public class AnyKeyControl : ButtonControl
{
////TODO: wasPressedThisFrame and wasReleasedThisFrame

Просмотреть файл

@ -12,7 +12,6 @@ namespace UnityEngine.InputSystem.Controls
/// Can optionally be configured to perform normalization.
/// Stored as either a float, a short, a byte, or a single bit.
/// </remarks>
[Scripting.Preserve]
public class AxisControl : InputControl<float>
{
/// <summary>

Просмотреть файл

@ -14,7 +14,6 @@ namespace UnityEngine.InputSystem.Controls
/// yield full floating-point values and may thus have a range of values. See
/// <see cref="pressPoint"/> for how button presses on such buttons are handled.
/// </remarks>
[Preserve]
public class ButtonControl : AxisControl
{
////REVIEW: are per-control press points really necessary? can we just drop them?

Просмотреть файл

@ -17,7 +17,6 @@ namespace UnityEngine.InputSystem.Controls
/// the value 1 could indicate that the switch is moved to the left whereas 3 could indicate it is
/// moved up.
/// </remarks>
[Scripting.Preserve]
public class DiscreteButtonControl : ButtonControl
{
/// <summary>

Просмотреть файл

@ -5,7 +5,6 @@ namespace UnityEngine.InputSystem.Controls
/// <summary>
/// A control reading a <see cref="double"/>.
/// </summary>
[Scripting.Preserve]
public class DoubleControl : InputControl<double>
{
/// <summary>

Просмотреть файл

@ -15,11 +15,9 @@ namespace UnityEngine.InputSystem.Controls
/// even if pressing diagonally, the vector will have a length of 1 (instead
/// of reading something like <c>(1,1)</c> for example).
/// </remarks>
[Scripting.Preserve]
public class DpadControl : Vector2Control
{
[InputControlLayout(hideInUI = true)]
[Scripting.Preserve]
public class DpadAxisControl : AxisControl
{
public int component { get; set; }

Просмотреть файл

@ -106,7 +106,6 @@ namespace UnityEngine.InputSystem
/// <seealso cref="InputControlPath"/>
/// <seealso cref="InputStateBlock"/>
[DebuggerDisplay("{DebuggerDisplay(),nq}")]
[Scripting.Preserve]
public abstract class InputControl
{
/// <summary>
@ -979,7 +978,6 @@ namespace UnityEngine.InputSystem
/// <typeparam name="TValue">Type of value captured by the control. Note that this does not mean
/// that the control has to store data in the given value format. A control that captures float
/// values, for example, may be stored in state as byte values instead.</typeparam>
[Scripting.Preserve]
public abstract class InputControl<TValue> : InputControl
where TValue : struct
{

Просмотреть файл

@ -25,7 +25,6 @@ namespace UnityEngine.InputSystem
/// <seealso cref="InputBinding.processors"/>
/// <seealso cref="InputControlLayout.ControlItem.processors"/>
/// <seealso cref="InputSystem.RegisterProcessor{T}"/>
[Preserve]
public abstract class InputProcessor
{
/// <summary>
@ -123,7 +122,6 @@ namespace UnityEngine.InputSystem
/// editing UIs for processors.
/// </remarks>
/// <seealso cref="InputSystem.RegisterProcessor"/>
[Scripting.Preserve]
public abstract class InputProcessor<TValue> : InputProcessor
where TValue : struct
{

Просмотреть файл

@ -7,7 +7,6 @@ namespace UnityEngine.InputSystem.Controls
/// <summary>
/// A generic input control reading integer values.
/// </summary>
[Scripting.Preserve]
public class IntegerControl : InputControl<int>
{
/// <summary>

Просмотреть файл

@ -16,7 +16,6 @@ namespace UnityEngine.InputSystem.Controls
/// layout specific and does not need to be key-by-key. For general text input, see <see cref="Keyboard.onTextInput"/>.
/// To find the text displayed on a key, use <see cref="InputControl.displayName"/>.
/// </remarks>
[Preserve]
public class KeyControl : ButtonControl
{
/// <summary>

Просмотреть файл

@ -24,7 +24,6 @@ namespace UnityEngine.InputSystem.Processors
/// </example>
/// </remarks>
/// <seealso cref="StickDeadzoneProcessor"/>
[Preserve]
public class AxisDeadzoneProcessor : InputProcessor<float>
{
/// <summary>

Просмотреть файл

@ -23,7 +23,6 @@ namespace UnityEngine.InputSystem.Processors
/// new InputAction(binding: "&lt;Gamepad&gt;/rightTrigger", processors: "clamp(min=0.3,max=0.7)");
/// </example>
/// </remarks>
[Preserve]
public class ClampProcessor : InputProcessor<float>
{
/// <summary>

Просмотреть файл

@ -4,7 +4,6 @@ using UnityEngine.InputSystem.LowLevel;
namespace UnityEngine.InputSystem.Processors
{
[DesignTimeVisible(false)]
[Scripting.Preserve]
internal class CompensateRotationProcessor : InputProcessor<Quaternion>
{
public override Quaternion Process(Quaternion value, InputControl control)

Просмотреть файл

@ -18,7 +18,6 @@ namespace UnityEngine.InputSystem.Processors
/// </remarks>
/// <seealso cref="Pointer.position"/>
[DesignTimeVisible(false)]
[Scripting.Preserve]
public class EditorWindowSpaceProcessor : InputProcessor<Vector2>
{
/// <summary>

Просмотреть файл

@ -15,7 +15,6 @@ namespace UnityEngine.InputSystem.Processors
/// </code>
/// </example>
/// </remarks>
[Preserve]
public class InvertProcessor : InputProcessor<float>
{
/// <summary>

Просмотреть файл

@ -16,7 +16,6 @@ namespace UnityEngine.InputSystem.Processors
/// </example>
/// </remarks>
/// <seealso cref="InvertVector3Processor"/>
[Preserve]
public class InvertVector2Processor : InputProcessor<Vector2>
{
/// <summary>

Просмотреть файл

@ -16,7 +16,6 @@ namespace UnityEngine.InputSystem.Processors
/// </example>
/// </remarks>
/// <seealso cref="InvertVector2Processor"/>
[Preserve]
public class InvertVector3Processor : InputProcessor<Vector3>
{
/// <summary>

Просмотреть файл

@ -27,7 +27,6 @@ namespace UnityEngine.InputSystem.Processors
/// </remarks>
/// <seealso cref="NormalizeVector2Processor"/>
/// <seealso cref="NormalizeVector3Processor"/>
[Preserve]
public class NormalizeProcessor : InputProcessor<float>
{
/// <summary>

Просмотреть файл

@ -9,7 +9,6 @@ namespace UnityEngine.InputSystem.Processors
/// This processor is registered (see <see cref="InputSystem.RegisterProcessor{T}"/>) under the name "normalizeVector2".
/// </remarks>
/// <seealso cref="NormalizeVector3Processor"/>
[Preserve]
public class NormalizeVector2Processor : InputProcessor<Vector2>
{
/// <summary>

Просмотреть файл

@ -9,7 +9,6 @@ namespace UnityEngine.InputSystem.Processors
/// This processor is registered (see <see cref="InputSystem.RegisterProcessor{T}"/>) under the name "normalizeVector3".
/// </remarks>
/// <seealso cref="NormalizeVector2Processor"/>
[Preserve]
public class NormalizeVector3Processor : InputProcessor<Vector3>
{
/// <summary>

Просмотреть файл

@ -17,7 +17,6 @@ namespace UnityEngine.InputSystem.Processors
/// </remarks>
/// <seealso cref="ScaleVector2Processor"/>
/// <seealso cref="ScaleVector3Processor"/>
[Preserve]
public class ScaleProcessor : InputProcessor<float>
{
/// <summary>

Просмотреть файл

@ -15,7 +15,6 @@ namespace UnityEngine.InputSystem.Processors
/// </remarks>
/// <seealso cref="ScaleProcessor"/>
/// <seealso cref="ScaleVector3Processor"/>
[Scripting.Preserve]
public class ScaleVector2Processor : InputProcessor<Vector2>
{
/// <summary>

Просмотреть файл

@ -17,7 +17,6 @@ namespace UnityEngine.InputSystem.Processors
/// </remarks>
/// <seealso cref="ScaleProcessor"/>
/// <seealso cref="ScaleVector2Processor"/>
[Preserve]
public class ScaleVector3Processor : InputProcessor<Vector3>
{
/// <summary>

Просмотреть файл

@ -15,7 +15,6 @@ namespace UnityEngine.InputSystem.Processors
/// than just clamping individual axes). Normalizes to the min/max range.
/// </summary>
/// <seealso cref="AxisDeadzoneProcessor"/>
[Preserve]
public class StickDeadzoneProcessor : InputProcessor<Vector2>
{
/// <summary>

Просмотреть файл

@ -8,7 +8,6 @@ namespace UnityEngine.InputSystem.Controls
/// <summary>
/// A generic input control reading quaternion (rotation) values.
/// </summary>
[Scripting.Preserve]
public class QuaternionControl : InputControl<Quaternion>
{
// Accessing these components as individual controls usually doesn't make too much sense,

Просмотреть файл

@ -46,7 +46,6 @@ namespace UnityEngine.InputSystem.Controls
/// the deadzoning of sticks is radial (i.e. the length of the vector is taken into account
/// which means that <em>both</em> the X and Y axis contribute).
/// </remarks>
[Scripting.Preserve]
public class StickControl : Vector2Control
{
////REVIEW: should X and Y have "Horizontal" and "Vertical" as long display names and "X" and "Y" as short names?
@ -76,19 +75,15 @@ namespace UnityEngine.InputSystem.Controls
// Also puts AxisDeadzones on the axes.
[InputControl(name = "x", minValue = -1f, maxValue = 1f, layout = "Axis", processors = "axisDeadzone")]
[InputControl(name = "y", minValue = -1f, maxValue = 1f, layout = "Axis", processors = "axisDeadzone")]
[Scripting.Preserve]
public ButtonControl up { get; set; }
[InputControl(useStateFrom = "y", processors = "axisDeadzone", parameters = "clamp=2,clampMin=-1,clampMax=0,invert", synthetic = true, displayName = "Down")]
[Scripting.Preserve]
public ButtonControl down { get; set; }
[InputControl(useStateFrom = "x", processors = "axisDeadzone", parameters = "clamp=2,clampMin=-1,clampMax=0,invert", synthetic = true, displayName = "Left")]
[Scripting.Preserve]
public ButtonControl left { get; set; }
[InputControl(useStateFrom = "x", processors = "axisDeadzone", parameters = "clamp=2,clampMin=0,clampMax=1", synthetic = true, displayName = "Right")]
[Scripting.Preserve]
public ButtonControl right { get; set; }
protected override void FinishSetup()

Просмотреть файл

@ -19,7 +19,6 @@ namespace UnityEngine.InputSystem.Controls
/// at exactly those memory addresses.
/// </remarks>
[InputControlLayout(stateType = typeof(TouchState))]
[Preserve]
public class TouchControl : InputControl<TouchState>
{
/// <summary>

Просмотреть файл

@ -17,7 +17,6 @@ namespace UnityEngine.InputSystem.Controls
/// </remarks>
/// <seealso cref="Touchscreen"/>
[InputControlLayout(hideInUI = true)]
[Scripting.Preserve]
public class TouchPhaseControl : InputControl<TouchPhase>
{
/// <summary>

Просмотреть файл

@ -17,7 +17,6 @@ namespace UnityEngine.InputSystem.Controls
/// </remarks>
/// <seealso cref="TouchControl"/>
[InputControlLayout(hideInUI = true)]
[Scripting.Preserve]
public class TouchPressControl : ButtonControl
{
/// <inheritdoc />

Просмотреть файл

@ -19,7 +19,6 @@ namespace UnityEngine.InputSystem.Controls
/// Normalization is not implied. The X and Y coordinates can be in any range or units.
/// </example>
/// </remarks>
[Scripting.Preserve]
public class Vector2Control : InputControl<Vector2>
{
/// <summary>

Просмотреть файл

@ -6,7 +6,6 @@ namespace UnityEngine.InputSystem.Controls
/// <summary>
/// A floating-point 3D vector control composed of three <see cref="AxisControl">AxisControls</see>.
/// </summary>
[Scripting.Preserve]
public class Vector3Control : InputControl<Vector3>
{
[InputControl(offset = 0, displayName = "X")]

Просмотреть файл

@ -368,7 +368,6 @@ namespace UnityEngine.InputSystem
/// </example>
/// </remarks>
[InputControlLayout(stateType = typeof(GamepadState), isGenericTypeOfDevice = true)]
[Preserve]
public class Gamepad : InputDevice, IDualMotorRumble
{
/// <summary>

Просмотреть файл

@ -143,7 +143,6 @@ namespace UnityEngine.InputSystem
/// <seealso cref="Keyboard"/>
/// <seealso cref="Gamepad"/>
/// <seealso cref="Touchscreen"/>
[Scripting.Preserve]
public class InputDevice : InputControl
{
/// <summary>

Просмотреть файл

@ -50,7 +50,6 @@ namespace UnityEngine.InputSystem
/// from other types of devices.
/// </remarks>
[InputControlLayout(stateType = typeof(JoystickState), isGenericTypeOfDevice = true)]
[Scripting.Preserve]
public class Joystick : InputDevice
{
/// <summary>

Просмотреть файл

@ -861,7 +861,6 @@ namespace UnityEngine.InputSystem
/// keyboard has certain keys or not.
/// </remarks>
[InputControlLayout(stateType = typeof(KeyboardState), isGenericTypeOfDevice = true)]
[Scripting.Preserve]
public class Keyboard : InputDevice, ITextInputReceiver
{
/// <summary>

Просмотреть файл

@ -167,7 +167,6 @@ namespace UnityEngine.InputSystem
/// To control cursor display and behavior, use <see cref="UnityEngine.Cursor"/>.
/// </remarks>
[InputControlLayout(stateType = typeof(MouseState), isGenericTypeOfDevice = true)]
[Scripting.Preserve]
public class Mouse : Pointer, IInputStateCallbackReceiver
{
/// <summary>

Просмотреть файл

@ -213,7 +213,6 @@ namespace UnityEngine.InputSystem
/// tablet surface.
/// </remarks>
[InputControlLayout(stateType = typeof(PenState), isGenericTypeOfDevice = true)]
[Scripting.Preserve]
public class Pen : Pointer
{
////TODO: give the tip and eraser a very low press point

Просмотреть файл

@ -83,7 +83,6 @@ namespace UnityEngine.InputSystem
/// <seealso cref="Pen"/>
/// <seealso cref="Touchscreen"/>
[InputControlLayout(stateType = typeof(PointerState), isGenericTypeOfDevice = true)]
[Preserve]
public class Pointer : InputDevice, IInputStateCallbackReceiver
{
////REVIEW: shouldn't this be done for every touch position, too?

Просмотреть файл

@ -89,7 +89,6 @@ namespace UnityEngine.InputSystem
/// a given sensor can be sampled.
/// </remarks>
[InputControlLayout(isGenericTypeOfDevice = true)]
[Scripting.Preserve]
public class Sensor : InputDevice
{
/// <summary>
@ -158,7 +157,6 @@ namespace UnityEngine.InputSystem
/// </example>
/// </remarks>
[InputControlLayout(stateType = typeof(AccelerometerState))]
[Scripting.Preserve]
public class Accelerometer : Sensor
{
public Vector3Control acceleration { get; private set; }
@ -199,7 +197,6 @@ namespace UnityEngine.InputSystem
/// A gyroscope let's you measure the angular velocity of a device, and can be useful to control content by rotating a device.
/// </remarks>
[InputControlLayout(stateType = typeof(GyroscopeState))]
[Scripting.Preserve]
public class Gyroscope : Sensor
{
public Vector3Control angularVelocity { get; private set; }
@ -241,7 +238,6 @@ namespace UnityEngine.InputSystem
/// This is usually derived from a hardware <see cref="Accelerometer"/>, by subtracting the effect of linear acceleration (see <see cref="LinearAccelerationSensor"/>).
/// </remarks>
[InputControlLayout(stateType = typeof(GravityState), displayName = "Gravity")]
[Scripting.Preserve]
public class GravitySensor : Sensor
{
public Vector3Control gravity { get; private set; }
@ -284,7 +280,6 @@ namespace UnityEngine.InputSystem
/// An attitude sensor let's you determine the orientation of a device, and can be useful to control content by rotating a device.
/// </remarks>
[InputControlLayout(stateType = typeof(AttitudeState), displayName = "Attitude")]
[Scripting.Preserve]
public class AttitudeSensor : Sensor
{
public QuaternionControl attitude { get; private set; }
@ -327,7 +322,6 @@ namespace UnityEngine.InputSystem
/// This is usually derived from a hardware <see cref="Accelerometer"/>, by subtracting the effect of gravity (see <see cref="GravitySensor"/>).
/// </remarks>
[InputControlLayout(stateType = typeof(LinearAccelerationState), displayName = "Linear Acceleration")]
[Scripting.Preserve]
public class LinearAccelerationSensor : Sensor
{
public Vector3Control acceleration { get; private set; }
@ -365,7 +359,6 @@ namespace UnityEngine.InputSystem
/// Input device representing the magnetic field affecting the device playing the content.
/// </summary>
[InputControlLayout(displayName = "Magnetic Field")]
[Scripting.Preserve]
public class MagneticFieldSensor : Sensor
{
/// <summary>
@ -411,7 +404,6 @@ namespace UnityEngine.InputSystem
/// Input device representing the ambient light measured by the device playing the content.
/// </summary>
[InputControlLayout(displayName = "Light")]
[Scripting.Preserve]
public class LightSensor : Sensor
{
/// <summary>
@ -453,7 +445,6 @@ namespace UnityEngine.InputSystem
/// Input device representing the atmospheric pressure measured by the device playing the content.
/// </summary>
[InputControlLayout(displayName = "Pressure")]
[Scripting.Preserve]
public class PressureSensor : Sensor
{
/// <summary>
@ -498,7 +489,6 @@ namespace UnityEngine.InputSystem
/// The proximity sensor is usually used by phones to determine if the user is holding the phone to their ear or not.
/// </remarks>
[InputControlLayout(displayName = "Proximity")]
[Scripting.Preserve]
public class ProximitySensor : Sensor
{
/// <summary>
@ -540,7 +530,6 @@ namespace UnityEngine.InputSystem
/// Input device representing the ambient air humidity measured by the device playing the content.
/// </summary>
[InputControlLayout(displayName = "Humidity")]
[Scripting.Preserve]
public class HumiditySensor : Sensor
{
/// <summary>
@ -582,7 +571,6 @@ namespace UnityEngine.InputSystem
/// Input device representing the ambient air temperature measured by the device playing the content.
/// </summary>
[InputControlLayout(displayName = "Ambient Temperature")]
[Scripting.Preserve]
public class AmbientTemperatureSensor : Sensor
{
/// <summary>
@ -627,7 +615,6 @@ namespace UnityEngine.InputSystem
/// On iOS, access to the step counter must be enabled via <see cref="InputSettings.iOSSettings.motionUsage"/>.
/// </remarks>
[InputControlLayout(displayName = "Step Counter")]
[Scripting.Preserve]
public class StepCounter : Sensor
{
/// <summary>

Просмотреть файл

@ -488,7 +488,6 @@ namespace UnityEngine.InputSystem
/// it is recommended to use the higher-level <see cref="EnhancedTouch.Touch"/> API instead.
/// </remarks>
[InputControlLayout(stateType = typeof(TouchscreenState), isGenericTypeOfDevice = true)]
[Scripting.Preserve]
public class Touchscreen : Pointer, IInputStateCallbackReceiver, IEventMerger
{
/// <summary>

Просмотреть файл

@ -10,20 +10,15 @@ namespace UnityEngine.InputSystem
/// <seealso cref="UnityEngine.InputSystem.XR.XRController"/>
/// <seealso cref="UnityEngine.InputSystem.XR.XRHMD"/>
[InputControlLayout(displayName = "Tracked Device", isGenericTypeOfDevice = true)]
[Preserve]
public class TrackedDevice : InputDevice
{
[InputControl(synthetic = true)]
[Preserve]
public IntegerControl trackingState { get; private set; }
[InputControl(synthetic = true)]
[Preserve]
public ButtonControl isTracked { get; private set; }
[InputControl(noisy = true, dontReset = true)]
[Preserve]
public Vector3Control devicePosition { get; private set; }
[InputControl(noisy = true, dontReset = true)]
[Preserve]
public QuaternionControl deviceRotation { get; private set; }
protected override void FinishSetup()

Просмотреть файл

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cb6feb90190641c19dce92f09614edd4
timeCreated: 1633522402

Просмотреть файл

@ -0,0 +1,142 @@
#if UNITY_EDITOR
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using UnityEngine.InputSystem.LowLevel;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEditor.Compilation;
using UnityEditor.UnityLinker;
using UnityEngine.InputSystem.Layouts;
namespace UnityEngine.InputSystem.Editor
{
/// <summary>
/// Input system uses runtime reflection to instantiate and discover some capabilities like layouts, processors, interactions, etc.
/// Managed linker on high stripping modes is very keen on removing parts of classes or whole classes.
/// One way to preserve the classes is to put [Preserve] on class itself and every field/property we're interested in,
/// this was proven to be error prone as it's easy to forget an attribute and tedious as everything needs an attribute now.
///
/// Instead this LinkFileGenerator inspects all types in the domain, and if they could be used via reflection,
/// we preserve them in all entirety.
///
/// In a long run we would like to remove usage of reflection all together, and then this mechanism will be gone too.
///
/// Beware, this uses "AppDomain.CurrentDomain.GetAssemblies" which returns editor assemblies,
/// but not all classes are available on all platforms, most of platform specific code is wrapped into defines like
/// "#if UNITY_EDITOR || UNITY_IOS || PACKAGE_DOCS_GENERATION", and when compiling for Android,
/// that particular class wouldn't be available in the final executable, though our link.xml here would still specify it,
/// potentially creating linker warnings that we need to later ignore.
/// </summary>
internal class LinkFileGenerator : IUnityLinkerProcessor
{
public int callbackOrder => 0;
public string GenerateAdditionalLinkXmlFile(BuildReport report, UnityLinkerBuildPipelineData data)
{
var currentAssemblyName = typeof(UnityEngine.InputSystem.InputSystem).Assembly.GetName().Name;
var typesByAssemblies = new Dictionary<System.Reflection.Assembly, Type[]>();
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in assemblies)
{
try
{
// Skip any assembly that doesn't reference the input system assembly.
if (assembly.GetName().Name != currentAssemblyName && !assembly
.GetReferencedAssemblies().Any(x => x.Name == currentAssemblyName))
continue;
var types = assembly.GetTypes().Where(ShouldPreserveType).ToArray();
if (types.Length > 0)
typesByAssemblies.Add(assembly, types);
}
catch (ReflectionTypeLoadException)
{
Debug.LogWarning($"Couldn't load types from assembly: {assembly.FullName}");
}
}
var sb = new StringBuilder();
sb.AppendLine("<linker>");
foreach (var assembly in typesByAssemblies.Keys.OrderBy(a => a.GetName().Name))
{
sb.AppendLine($" <assembly fullname=\"{assembly.GetName().Name}\">");
var types = typesByAssemblies[assembly];
foreach (var type in types.OrderBy(t => t.FullName))
sb.AppendLine(
$" <type fullname=\"{FormatForXml(ToCecilName(type.FullName))}\" preserve=\"all\"/>");
sb.AppendLine(" </assembly>");
}
sb.AppendLine("</linker>");
var filePathName = Path.Combine(data.inputDirectory, "InputSystemLink.xml");
File.WriteAllText(filePathName, sb.ToString());
return filePathName;
}
static bool IsTypeUsedViaReflectionByInputSystem(Type type)
{
return type.IsSubclassOf(typeof(InputControl)) ||
typeof(IInputStateTypeInfo).IsAssignableFrom(type) ||
typeof(IInputInteraction).IsAssignableFrom(type) ||
typeof(InputProcessor).IsAssignableFrom(type) ||
typeof(InputBindingComposite).IsAssignableFrom(type) ||
type.GetCustomAttributes<InputControlAttribute>().Any();
}
static bool IsFieldRelatedToControlLayouts(FieldInfo field)
{
return IsTypeUsedViaReflectionByInputSystem(field.GetType()) ||
field.GetCustomAttributes<InputControlAttribute>().Any();
}
static bool IsPropertyRelatedToControlLayouts(PropertyInfo property)
{
return IsTypeUsedViaReflectionByInputSystem(property.GetType()) ||
property.GetCustomAttributes<InputControlAttribute>().Any();
}
static bool ShouldPreserveType(Type type)
{
if (IsTypeUsedViaReflectionByInputSystem(type))
return true;
foreach (var field in type.GetFields())
if (IsFieldRelatedToControlLayouts(field))
return true;
foreach (var property in type.GetProperties())
if (IsPropertyRelatedToControlLayouts(property))
return true;
return false;
}
static string ToCecilName(string fullTypeName)
{
return fullTypeName.Replace('+', '/');
}
static string FormatForXml(string value)
{
return value.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;");
}
public void OnBeforeRun(BuildReport report, UnityLinkerBuildPipelineData data)
{
}
public void OnAfterRun(BuildReport report, UnityLinkerBuildPipelineData data)
{
}
}
}
#endif

Просмотреть файл

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: cec9e0ea8cd94017b8667cd540d61948
timeCreated: 1633522419

Просмотреть файл

@ -177,7 +177,6 @@ namespace UnityEngine.InputSystem.Android
/// While we can do custom mapping for Samsung, we can never now when will they try to update the driver for Dualshock or some other gamepad
/// </remarks>
[InputControlLayout(stateType = typeof(AndroidGameControllerState), variants = AndroidGameControllerState.kVariantGamepad)]
[Scripting.Preserve]
public class AndroidGamepad : Gamepad
{
}
@ -187,7 +186,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
[InputControlLayout(stateType = typeof(AndroidGameControllerState), hideInUI = true,
variants = AndroidGameControllerState.kVariantGamepad + InputControlLayout.VariantSeparator + AndroidGameControllerState.kVariantDPadAxes)]
[Scripting.Preserve]
public class AndroidGamepadWithDpadAxes : AndroidGamepad
{
}
@ -197,7 +195,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
[InputControlLayout(stateType = typeof(AndroidGameControllerState), hideInUI = true,
variants = AndroidGameControllerState.kVariantGamepad + InputControlLayout.VariantSeparator + AndroidGameControllerState.kVariantDPadButtons)]
[Scripting.Preserve]
public class AndroidGamepadWithDpadButtons : AndroidGamepad
{
}
@ -206,7 +203,6 @@ namespace UnityEngine.InputSystem.Android
/// Joystick on Android.
/// </summary>
[InputControlLayout(stateType = typeof(AndroidGameControllerState), variants = AndroidGameControllerState.kVariantJoystick)]
[Scripting.Preserve]
public class AndroidJoystick : Joystick
{
}
@ -216,7 +212,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
[InputControlLayout(stateType = typeof(AndroidGameControllerState), displayName = "Android DualShock 4 Gamepad",
variants = AndroidGameControllerState.kVariantGamepad + InputControlLayout.VariantSeparator + AndroidGameControllerState.kVariantDPadAxes)]
[Scripting.Preserve]
public class DualShock4GamepadAndroid : DualShockGamepad
{
}
@ -226,7 +221,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
[InputControlLayout(stateType = typeof(AndroidGameControllerState), displayName = "Android Xbox One Controller",
variants = AndroidGameControllerState.kVariantGamepad + InputControlLayout.VariantSeparator + AndroidGameControllerState.kVariantDPadAxes)]
[Scripting.Preserve]
public class XboxOneGamepadAndroid : XInput.XInputController
{
}

Просмотреть файл

@ -124,7 +124,6 @@ namespace UnityEngine.InputSystem.Android.LowLevel
}
[DesignTimeVisible(false)]
[Scripting.Preserve]
internal class AndroidCompensateDirectionProcessor : CompensateDirectionProcessor
{
// Taken from platforms\android-<API>\arch-arm\usr\include\android\sensor.h
@ -139,7 +138,6 @@ namespace UnityEngine.InputSystem.Android.LowLevel
}
[DesignTimeVisible(false)]
[Scripting.Preserve]
internal class AndroidCompensateRotationProcessor : CompensateRotationProcessor
{
public override Quaternion Process(Quaternion value, InputControl control)
@ -165,7 +163,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
/// <seealso href="https://developer.android.com/reference/android/hardware/Sensor#TYPE_ACCELEROMETER"/>
[InputControlLayout(stateType = typeof(AndroidSensorState), variants = "Accelerometer", hideInUI = true)]
[Scripting.Preserve]
public class AndroidAccelerometer : Accelerometer
{
}
@ -175,7 +172,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
/// <seealso href="https://developer.android.com/reference/android/hardware/Sensor#TYPE_MAGNETIC_FIELD"/>
[InputControlLayout(stateType = typeof(AndroidSensorState), variants = "MagneticField", hideInUI = true)]
[Scripting.Preserve]
public class AndroidMagneticFieldSensor : MagneticFieldSensor
{
}
@ -185,7 +181,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
/// <seealso href="https://developer.android.com/reference/android/hardware/Sensor#TYPE_GYROSCOPE"/>
[InputControlLayout(stateType = typeof(AndroidSensorState), variants = "Gyroscope", hideInUI = true)]
[Scripting.Preserve]
public class AndroidGyroscope : Gyroscope
{
}
@ -195,7 +190,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
/// <seealso href="https://developer.android.com/reference/android/hardware/Sensor#TYPE_LIGHT"/>
[InputControlLayout(stateType = typeof(AndroidSensorState), variants = "Light", hideInUI = true)]
[Scripting.Preserve]
public class AndroidLightSensor : LightSensor
{
}
@ -205,7 +199,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
/// <seealso href="https://developer.android.com/reference/android/hardware/Sensor#TYPE_PRESSURE"/>
[InputControlLayout(stateType = typeof(AndroidSensorState), variants = "Pressure", hideInUI = true)]
[Scripting.Preserve]
public class AndroidPressureSensor : PressureSensor
{
}
@ -215,7 +208,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
/// <seealso href="https://developer.android.com/reference/android/hardware/Sensor#TYPE_PROXIMITY"/>
[InputControlLayout(stateType = typeof(AndroidSensorState), variants = "Proximity", hideInUI = true)]
[Scripting.Preserve]
public class AndroidProximity : ProximitySensor
{
}
@ -225,7 +217,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
/// <seealso href="https://developer.android.com/reference/android/hardware/Sensor#TYPE_GRAVITY"/>
[InputControlLayout(stateType = typeof(AndroidSensorState), variants = "Gravity", hideInUI = true)]
[Scripting.Preserve]
public class AndroidGravitySensor : GravitySensor
{
}
@ -235,7 +226,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
/// <seealso href="https://developer.android.com/reference/android/hardware/Sensor#TYPE_LINEAR_ACCELERATION"/>
[InputControlLayout(stateType = typeof(AndroidSensorState), variants = "LinearAcceleration", hideInUI = true)]
[Scripting.Preserve]
public class AndroidLinearAccelerationSensor : LinearAccelerationSensor
{
}
@ -245,7 +235,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
/// <seealso href="https://developer.android.com/reference/android/hardware/Sensor#TYPE_ROTATION_VECTOR"/>
[InputControlLayout(stateType = typeof(AndroidSensorState), variants = "RotationVector", hideInUI = true)]
[Scripting.Preserve]
public class AndroidRotationVector : AttitudeSensor
{
}
@ -255,7 +244,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
/// <seealso href="https://developer.android.com/reference/android/hardware/Sensor#TYPE_RELATIVE_HUMIDITY"/>
[InputControlLayout(stateType = typeof(AndroidSensorState), variants = "RelativeHumidity", hideInUI = true)]
[Scripting.Preserve]
public class AndroidRelativeHumidity : HumiditySensor
{
}
@ -265,7 +253,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
/// <seealso href="https://developer.android.com/reference/android/hardware/Sensor#TYPE_AMBIENT_TEMPERATURE"/>
[InputControlLayout(stateType = typeof(AndroidSensorState), variants = "AmbientTemperature", hideInUI = true)]
[Scripting.Preserve]
public class AndroidAmbientTemperature : AmbientTemperatureSensor
{
}
@ -275,7 +262,6 @@ namespace UnityEngine.InputSystem.Android
/// </summary>
/// <seealso href="https://developer.android.com/reference/android/hardware/Sensor#TYPE_STEP_COUNTER"/>
[InputControlLayout(stateType = typeof(AndroidSensorState), variants = "StepCounter", hideInUI = true)]
[Scripting.Preserve]
public class AndroidStepCounter : StepCounter
{
}

Просмотреть файл

@ -12,7 +12,6 @@ namespace UnityEngine.InputSystem.DualShock
/// A Sony DualShock/DualSense controller.
/// </summary>
[InputControlLayout(displayName = "PlayStation Controller")]
[Preserve]
public class DualShockGamepad : Gamepad, IDualShockHaptics
{
/// <summary>

Просмотреть файл

@ -339,7 +339,6 @@ namespace UnityEngine.InputSystem.DualShock
/// PS5 DualSense controller that is interfaced to a HID backend.
/// </summary>
[InputControlLayout(stateType = typeof(DualSenseHIDInputReport), displayName = "DualSense HID")]
[Scripting.Preserve]
public class DualSenseGamepadHID : DualShockGamepad, IEventMerger, IEventPreProcessor
{
// Gamepad might send 3 types of input reports:
@ -671,7 +670,6 @@ namespace UnityEngine.InputSystem.DualShock
/// PS4 DualShock controller that is interfaced to a HID backend.
/// </summary>
[InputControlLayout(stateType = typeof(DualShock4HIDInputReport), hideInUI = true)]
[Scripting.Preserve]
public class DualShock4GamepadHID : DualShockGamepad
{
public ButtonControl leftTriggerButton { get; protected set; }
@ -794,7 +792,6 @@ namespace UnityEngine.InputSystem.DualShock
}
[InputControlLayout(stateType = typeof(DualShock3HIDInputReport), hideInUI = true, displayName = "PS3 Controller")]
[Scripting.Preserve]
public class DualShock3GamepadHID : DualShockGamepad
{
public ButtonControl leftTriggerButton { get; private set; }

Просмотреть файл

@ -42,7 +42,6 @@ namespace UnityEngine.InputSystem.HID
/// construct more specific device representations such as Gamepad.
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces")]
[Preserve]
public class HID : InputDevice
{
internal const string kHIDInterface = "HID";

Просмотреть файл

@ -57,7 +57,6 @@ namespace UnityEngine.InputSystem.Steam
/// E.g. a Unity action map called "gameplay" will be looked up as a Steam action set
/// using the same name "gameplay".
/// </remarks>
[Scripting.Preserve]
public abstract class SteamController : InputDevice
{
internal const string kSteamInterface = "Steam";

Просмотреть файл

@ -117,7 +117,6 @@ namespace UnityEngine.InputSystem.Switch
/// This controller currently only works when connected via Bluetooth but not when connected over USB.
/// </remarks>
[InputControlLayout(stateType = typeof(SwitchProControllerHIDInputState), displayName = "Switch Pro Controller")]
[Scripting.Preserve]
public class SwitchProControllerHID : Gamepad
{
}

Просмотреть файл

@ -150,7 +150,6 @@ namespace UnityEngine.InputSystem.WebGL
/// </summary>
/// <seealso href="https://w3c.github.io/gamepad/#remapping"/>
[InputControlLayout(stateType = typeof(WebGLGamepadState), displayName = "WebGL Gamepad (\"standard\" mapping)")]
[Scripting.Preserve]
public class WebGLGamepad : Gamepad
{
}

Просмотреть файл

@ -5,7 +5,6 @@ namespace UnityEngine.InputSystem.WebGL
/// <summary>
/// A Joystick or Gamepad on WebGL that does not have any known mapping.
/// </summary>
[Scripting.Preserve]
public class WebGLJoystick : Joystick
{
}

Просмотреть файл

@ -48,7 +48,6 @@ namespace UnityEngine.InputSystem.XInput
/// "XInputController".
/// </remarks>
[InputControlLayout(displayName = "Xbox Controller")]
[Scripting.Preserve]
public class XInputController : Gamepad
{
/// <summary>

Просмотреть файл

@ -92,7 +92,6 @@ namespace UnityEngine.InputSystem.XInput
/// An <see cref="XInputController"/> compatible game controller connected to a Windows desktop machine.
/// </summary>
[InputControlLayout(stateType = typeof(XInputControllerWindowsState), hideInUI = true)]
[Preserve]
public class XInputControllerWindows : XInputController
{
}

Просмотреть файл

@ -206,7 +206,6 @@ namespace UnityEngine.InputSystem.XInput
/// to work.
/// </remarks>
[InputControlLayout(displayName = "Xbox Controller", stateType = typeof(XInputControllerOSXState), hideInUI = true)]
[Preserve]
public class XboxGamepadMacOS : XInputController
{
}
@ -221,7 +220,6 @@ namespace UnityEngine.InputSystem.XInput
/// Unlike wired controllers, bluetooth-cabable Xbox One controllers do not need a custom driver to work on macOS.
/// </remarks>
[InputControlLayout(displayName = "Wireless Xbox Controller", stateType = typeof(XInputControllerWirelessOSXState), hideInUI = true)]
[Preserve]
public class XboxOneGampadMacOSWireless : XInputController
{
}

Просмотреть файл

@ -10,7 +10,6 @@ namespace Unity.XR.GoogleVr
/// A head-mounted display powered by Google Daydream.
/// </summary>
[InputControlLayout(displayName = "Daydream Headset")]
[Preserve]
public class DaydreamHMD : XRHMD
{
}
@ -19,41 +18,29 @@ namespace Unity.XR.GoogleVr
/// An XR controller powered by Google Daydream.
/// </summary>
[InputControlLayout(displayName = "Daydream Controller", commonUsages = new[] { "LeftHand", "RightHand" })]
[Preserve]
public class DaydreamController : XRController
{
[InputControl]
[Preserve]
public Vector2Control touchpad { get; private set; }
[InputControl]
[Preserve]
public ButtonControl volumeUp { get; private set; }
[InputControl]
[Preserve]
public ButtonControl recentered { get; private set; }
[InputControl]
[Preserve]
public ButtonControl volumeDown { get; private set; }
[InputControl]
[Preserve]
public ButtonControl recentering { get; private set; }
[InputControl]
[Preserve]
public ButtonControl app { get; private set; }
[InputControl]
[Preserve]
public ButtonControl home { get; private set; }
[InputControl]
[Preserve]
public ButtonControl touchpadClicked { get; private set; }
[InputControl]
[Preserve]
public ButtonControl touchpadTouched { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control deviceVelocity { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control deviceAcceleration { get; private set; }
protected override void FinishSetup()

Просмотреть файл

@ -11,48 +11,34 @@ namespace Unity.XR.Oculus.Input
/// An Oculus VR headset (such as the Oculus Rift series of devices).
/// </summary>
[InputControlLayout(displayName = "Oculus Headset")]
[Preserve]
public class OculusHMD : XRHMD
{
[Preserve]
[InputControl]
[InputControl(name = "trackingState", layout = "Integer", aliases = new[] { "devicetrackingstate" })]
[InputControl(name = "isTracked", layout = "Button", aliases = new[] { "deviceistracked" })]
public ButtonControl userPresence { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control deviceAngularVelocity { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control deviceAcceleration { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control deviceAngularAcceleration { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control leftEyeAngularVelocity { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control leftEyeAcceleration { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control leftEyeAngularAcceleration { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control rightEyeAngularVelocity { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control rightEyeAcceleration { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control rightEyeAngularAcceleration { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control centerEyeAngularVelocity { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control centerEyeAcceleration { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control centerEyeAngularAcceleration { get; private set; }
@ -80,65 +66,47 @@ namespace Unity.XR.Oculus.Input
/// <summary>
/// An Oculus Touch controller.
/// </summary>
[Preserve]
[InputControlLayout(displayName = "Oculus Touch Controller", commonUsages = new[] { "LeftHand", "RightHand" })]
public class OculusTouchController : XRControllerWithRumble
{
[Preserve]
[InputControl(aliases = new[] { "Primary2DAxis", "Joystick" })]
public Vector2Control thumbstick { get; private set; }
[Preserve]
[InputControl]
public AxisControl trigger { get; private set; }
[Preserve]
[InputControl]
public AxisControl grip { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "A", "X", "Alternate" })]
public ButtonControl primaryButton { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "B", "Y", "Primary" })]
public ButtonControl secondaryButton { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "GripButton" })]
public ButtonControl gripPressed { get; private set; }
[Preserve]
[InputControl]
public ButtonControl start { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "JoystickOrPadPressed", "thumbstickClick" })]
public ButtonControl thumbstickClicked { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "ATouched", "XTouched", "ATouch", "XTouch" })]
public ButtonControl primaryTouched { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "BTouched", "YTouched", "BTouch", "YTouch" })]
public ButtonControl secondaryTouched { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "indexTouch", "indexNearTouched" })]
public AxisControl triggerTouched { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "indexButton", "indexTouched" })]
public ButtonControl triggerPressed { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "JoystickOrPadTouched", "thumbstickTouch" })]
[InputControl(name = "trackingState", layout = "Integer", aliases = new[] { "controllerTrackingState" })]
[InputControl(name = "isTracked", layout = "Button", aliases = new[] { "ControllerIsTracked" })]
[InputControl(name = "devicePosition", layout = "Vector3", aliases = new[] { "controllerPosition" })]
[InputControl(name = "deviceRotation", layout = "Quaternion", aliases = new[] { "controllerRotation" })]
public ButtonControl thumbstickTouched { get; private set; }
[Preserve]
[InputControl(noisy = true, aliases = new[] { "controllerVelocity" })]
public Vector3Control deviceVelocity { get; private set; }
[Preserve]
[InputControl(noisy = true, aliases = new[] { "controllerAngularVelocity" })]
public Vector3Control deviceAngularVelocity { get; private set; }
[Preserve]
[InputControl(noisy = true, aliases = new[] { "controllerAcceleration" })]
public Vector3Control deviceAcceleration { get; private set; }
[Preserve]
[InputControl(noisy = true, aliases = new[] { "controllerAngularAcceleration" })]
public Vector3Control deviceAngularAcceleration { get; private set; }
@ -168,13 +136,10 @@ namespace Unity.XR.Oculus.Input
}
}
[Preserve]
public class OculusTrackingReference : TrackedDevice
{
[Preserve]
[InputControl(aliases = new[] { "trackingReferenceTrackingState" })]
public new IntegerControl trackingState { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "trackingReferenceIsTracked" })]
public new ButtonControl isTracked { get; private set; }
@ -191,16 +156,12 @@ namespace Unity.XR.Oculus.Input
/// An Oculus Remote controller.
/// </summary>
[InputControlLayout(displayName = "Oculus Remote")]
[Preserve]
public class OculusRemote : InputDevice
{
[Preserve]
[InputControl]
public ButtonControl back { get; private set; }
[Preserve]
[InputControl]
public ButtonControl start { get; private set; }
[Preserve]
[InputControl]
public Vector2Control touchpad { get; private set; }
@ -218,13 +179,10 @@ namespace Unity.XR.Oculus.Input
/// A Standalone VR headset that includes on-headset controls.
/// </summary>
[InputControlLayout(displayName = "Oculus Headset (w/ on-headset controls)")]
[Preserve]
public class OculusHMDExtended : OculusHMD
{
[Preserve]
[InputControl]
public ButtonControl back { get; private set; }
[Preserve]
[InputControl]
public Vector2Control touchpad { get; private set; }
@ -240,35 +198,25 @@ namespace Unity.XR.Oculus.Input
/// <summary>
/// A Gear VR controller.
/// </summary>
[Preserve]
[InputControlLayout(displayName = "GearVR Controller", commonUsages = new[] { "LeftHand", "RightHand" })]
public class GearVRTrackedController : XRController
{
[Preserve]
[InputControl]
public Vector2Control touchpad { get; private set; }
[Preserve]
[InputControl]
public AxisControl trigger { get; private set; }
[Preserve]
[InputControl]
public ButtonControl back { get; private set; }
[Preserve]
[InputControl]
public ButtonControl triggerPressed { get; private set; }
[Preserve]
[InputControl]
public ButtonControl touchpadClicked { get; private set; }
[Preserve]
[InputControl]
public ButtonControl touchpadTouched { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control deviceAngularVelocity { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control deviceAcceleration { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control deviceAngularAcceleration { get; private set; }

Просмотреть файл

@ -8,32 +8,23 @@ using UnityEngine.Scripting;
namespace Unity.XR.OpenVR
{
[InputControlLayout(displayName = "OpenVR Headset")]
[Preserve]
public class OpenVRHMD : XRHMD
{
[InputControl(noisy = true)]
[Preserve]
public Vector3Control deviceVelocity { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control deviceAngularVelocity { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control leftEyeVelocity { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control leftEyeAngularVelocity { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control rightEyeVelocity { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control rightEyeAngularVelocity { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control centerEyeVelocity { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control centerEyeAngularVelocity { get; private set; }
protected override void FinishSetup()
@ -52,43 +43,32 @@ namespace Unity.XR.OpenVR
}
[InputControlLayout(displayName = "Windows MR Controller (OpenVR)", commonUsages = new[] { "LeftHand", "RightHand" })]
[Preserve]
public class OpenVRControllerWMR : XRController
{
[InputControl(noisy = true)]
[Preserve]
public Vector3Control deviceVelocity { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control deviceAngularVelocity { get; private set; }
[InputControl(aliases = new[] { "primary2DAxisClick", "joystickOrPadPressed" })]
[Preserve]
public ButtonControl touchpadClick { get; private set; }
[InputControl(aliases = new[] { "primary2DAxisTouch", "joystickOrPadTouched" })]
[Preserve]
public ButtonControl touchpadTouch { get; private set; }
[InputControl]
[Preserve]
public ButtonControl gripPressed { get; private set; }
[InputControl]
public ButtonControl triggerPressed { get; private set; }
[InputControl(aliases = new[] { "primary" })]
[Preserve]
public ButtonControl menu { get; private set; }
[InputControl]
[Preserve]
public AxisControl trigger { get; private set; }
[InputControl]
[Preserve]
public AxisControl grip { get; private set; }
[InputControl(aliases = new[] { "secondary2DAxis" })]
[Preserve]
public Vector2Control touchpad { get; private set; }
[InputControl(aliases = new[] { "primary2DAxis" })]
[Preserve]
public Vector2Control joystick { get; private set; }
protected override void FinishSetup()
@ -116,39 +96,28 @@ namespace Unity.XR.OpenVR
/// An HTC Vive Wand controller.
/// </summary>
[InputControlLayout(displayName = "Vive Wand", commonUsages = new[] { "LeftHand", "RightHand" })]
[Preserve]
public class ViveWand : XRControllerWithRumble
{
[InputControl]
[Preserve]
public AxisControl grip { get; private set; }
[InputControl]
[Preserve]
public ButtonControl gripPressed { get; private set; }
[InputControl]
[Preserve]
public ButtonControl primary { get; private set; }
[InputControl(aliases = new[] { "primary2DAxisClick", "joystickOrPadPressed" })]
[Preserve]
public ButtonControl trackpadPressed { get; private set; }
[InputControl(aliases = new[] { "primary2DAxisTouch", "joystickOrPadTouched" })]
[Preserve]
public ButtonControl trackpadTouched { get; private set; }
[InputControl(aliases = new[] { "Primary2DAxis" })]
[Preserve]
public Vector2Control trackpad { get; private set; }
[InputControl]
[Preserve]
public AxisControl trigger { get; private set; }
[InputControl]
[Preserve]
public ButtonControl triggerPressed { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control deviceVelocity { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control deviceAngularVelocity { get; private set; }
protected override void FinishSetup()
@ -173,7 +142,6 @@ namespace Unity.XR.OpenVR
/// An HTC Vive lighthouse.
/// </summary>
[InputControlLayout(displayName = "Vive Lighthouse")]
[Preserve]
public class ViveLighthouse : TrackedDevice
{
}
@ -182,14 +150,11 @@ namespace Unity.XR.OpenVR
/// An HTC Vive tracker.
/// </summary>
[InputControlLayout(displayName = "Vive Tracker")]
[Preserve]
public class ViveTracker : TrackedDevice
{
[InputControl(noisy = true)]
[Preserve]
public Vector3Control deviceVelocity { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control deviceAngularVelocity { get; private set; }
protected override void FinishSetup()
@ -202,23 +167,17 @@ namespace Unity.XR.OpenVR
}
[InputControlLayout(displayName = "Handed Vive Tracker", commonUsages = new[] { "LeftHand", "RightHand" })]
[Preserve]
public class HandedViveTracker : ViveTracker
{
[InputControl]
[Preserve]
public AxisControl grip { get; private set; }
[InputControl]
[Preserve]
public ButtonControl gripPressed { get; private set; }
[InputControl]
[Preserve]
public ButtonControl primary { get; private set; }
[InputControl(aliases = new[] { "JoystickOrPadPressed" })]
[Preserve]
public ButtonControl trackpadPressed { get; private set; }
[InputControl]
[Preserve]
public ButtonControl triggerPressed { get; private set; }
protected override void FinishSetup()
@ -237,46 +196,34 @@ namespace Unity.XR.OpenVR
/// An Oculus Touch controller.
/// </summary>
[InputControlLayout(displayName = "Oculus Touch Controller (OpenVR)", commonUsages = new[] { "LeftHand", "RightHand" })]
[Preserve]
public class OpenVROculusTouchController : XRControllerWithRumble
{
[InputControl]
[Preserve]
public Vector2Control thumbstick { get; private set; }
[InputControl]
[Preserve]
public AxisControl trigger { get; private set; }
[InputControl]
[Preserve]
public AxisControl grip { get; private set; }
// Primary & Secondary are switched in order to retain consistency with the Oculus SDK
[InputControl(aliases = new[] { "Alternate" })]
[Preserve]
public ButtonControl primaryButton { get; private set; }
[InputControl(aliases = new[] { "Primary" })]
[Preserve]
public ButtonControl secondaryButton { get; private set; }
[InputControl]
[Preserve]
public ButtonControl gripPressed { get; private set; }
[InputControl()]
[Preserve]
[InputControl]
public ButtonControl triggerPressed { get; private set; }
[InputControl(aliases = new[] { "primary2DAxisClicked" })]
[Preserve]
public ButtonControl thumbstickClicked { get; private set; }
[InputControl(aliases = new[] { "primary2DAxisTouch" })]
[Preserve]
public ButtonControl thumbstickTouched { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control deviceVelocity { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control deviceAngularVelocity { get; private set; }
protected override void FinishSetup()

Просмотреть файл

@ -9,11 +9,9 @@ namespace UnityEngine.XR.WindowsMR.Input
/// <summary>
/// A Windows Mixed Reality XR headset.
/// </summary>
[Preserve]
[InputControlLayout(displayName = "Windows MR Headset")]
public class WMRHMD : XRHMD
{
[Preserve]
[InputControl]
[InputControl(name = "devicePosition", layout = "Vector3", aliases = new[] { "HeadPosition" })]
[InputControl(name = "deviceRotation", layout = "Quaternion", aliases = new[] { "HeadRotation" })]
@ -30,20 +28,15 @@ namespace UnityEngine.XR.WindowsMR.Input
/// <summary>
/// A Windows Mixed Reality XR controller.
/// </summary>
[Preserve]
[InputControlLayout(displayName = "HoloLens Hand", commonUsages = new[] { "LeftHand", "RightHand" })]
public class HololensHand : XRController
{
[Preserve]
[InputControl(noisy = true, aliases = new[] { "gripVelocity" })]
public Vector3Control deviceVelocity { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "triggerbutton" })]
public ButtonControl airTap { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public AxisControl sourceLossRisk { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control sourceLossMitigationDirection { get; private set; }
@ -58,60 +51,42 @@ namespace UnityEngine.XR.WindowsMR.Input
}
}
[Preserve]
[InputControlLayout(displayName = "Windows MR Controller", commonUsages = new[] { "LeftHand", "RightHand" })]
public class WMRSpatialController : XRControllerWithRumble
{
[Preserve]
[InputControl(aliases = new[] { "Primary2DAxis", "thumbstickaxes" })]
public Vector2Control joystick { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "Secondary2DAxis", "touchpadaxes" })]
public Vector2Control touchpad { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "gripaxis" })]
public AxisControl grip { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "gripbutton" })]
public ButtonControl gripPressed { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "Primary", "menubutton" })]
public ButtonControl menu { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "triggeraxis" })]
public AxisControl trigger { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "triggerbutton" })]
public ButtonControl triggerPressed { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "thumbstickpressed" })]
public ButtonControl joystickClicked { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "joystickorpadpressed", "touchpadpressed" })]
public ButtonControl touchpadClicked { get; private set; }
[Preserve]
[InputControl(aliases = new[] { "joystickorpadtouched", "touchpadtouched" })]
public ButtonControl touchpadTouched { get; private set; }
[Preserve]
[InputControl(noisy = true, aliases = new[] { "gripVelocity" })]
public Vector3Control deviceVelocity { get; private set; }
[Preserve]
[InputControl(noisy = true, aliases = new[] { "gripAngularVelocity" })]
public Vector3Control deviceAngularVelocity { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public AxisControl batteryLevel { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public AxisControl sourceLossRisk { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control sourceLossMitigationDirection { get; private set; }
[Preserve]
[InputControl(noisy = true)]
public Vector3Control pointerPosition { get; private set; }
[Preserve]
[InputControl(noisy = true, aliases = new[] { "PointerOrientation" })]
public QuaternionControl pointerRotation { get; private set; }

Просмотреть файл

@ -11,26 +11,19 @@ namespace UnityEngine.InputSystem.XR
/// The base type of all XR head mounted displays. This can help organize shared behaviour across all HMDs.
/// </summary>
[InputControlLayout(isGenericTypeOfDevice = true, displayName = "XR HMD", canRunInBackground = true)]
[Preserve]
public class XRHMD : TrackedDevice
{
[InputControl(noisy = true)]
[Preserve]
public Vector3Control leftEyePosition { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public QuaternionControl leftEyeRotation { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control rightEyePosition { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public QuaternionControl rightEyeRotation { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public Vector3Control centerEyePosition { get; private set; }
[InputControl(noisy = true)]
[Preserve]
public QuaternionControl centerEyeRotation { get; private set; }
protected override void FinishSetup()
@ -50,7 +43,6 @@ namespace UnityEngine.InputSystem.XR
/// The base type for all XR handed controllers.
/// </summary>
[InputControlLayout(commonUsages = new[] { "LeftHand", "RightHand" }, isGenericTypeOfDevice = true, displayName = "XR Controller")]
[Preserve]
public class XRController : TrackedDevice
{
/// <summary>
@ -85,7 +77,6 @@ namespace UnityEngine.InputSystem.XR
/// <summary>
/// Identifies a controller that is capable of rumble or haptics.
/// </summary>
[Preserve]
public class XRControllerWithRumble : XRController
{
public void SendImpulse(float amplitude, float duration)

Просмотреть файл

@ -188,16 +188,12 @@ namespace UnityEngine.InputSystem.XR
public float rightEyeOpenAmount { get; set; }
}
[Preserve]
public class BoneControl : InputControl<Bone>
{
[Preserve]
[InputControl(offset = 0, displayName = "parentBoneIndex")]
public IntegerControl parentBoneIndex { get; private set; }
[Preserve]
[InputControl(offset = 4, displayName = "Position")]
public Vector3Control position { get; private set; }
[Preserve]
[InputControl(offset = 16, displayName = "Rotation")]
public QuaternionControl rotation { get; private set; }
@ -228,28 +224,20 @@ namespace UnityEngine.InputSystem.XR
}
}
[Preserve]
public class EyesControl : InputControl<Eyes>
{
[Preserve]
[InputControl(offset = 0, displayName = "LeftEyePosition")]
public Vector3Control leftEyePosition { get; private set; }
[Preserve]
[InputControl(offset = 12, displayName = "LeftEyeRotation")]
public QuaternionControl leftEyeRotation { get; private set; }
[Preserve]
[InputControl(offset = 28, displayName = "RightEyePosition")]
public Vector3Control rightEyePosition { get; private set; }
[Preserve]
[InputControl(offset = 40, displayName = "RightEyeRotation")]
public QuaternionControl rightEyeRotation { get; private set; }
[Preserve]
[InputControl(offset = 56, displayName = "FixationPoint")]
public Vector3Control fixationPoint { get; private set; }
[Preserve]
[InputControl(offset = 68, displayName = "LeftEyeOpenAmount")]
public AxisControl leftEyeOpenAmount { get; private set; }
[Preserve]
[InputControl(offset = 72, displayName = "RightEyeOpenAmount")]
public AxisControl rightEyeOpenAmount { get; private set; }

Просмотреть файл

@ -107,7 +107,6 @@ namespace UnityEngine.InputSystem.iOS
/// be represented as an iOSGameController.
/// </remarks>
[InputControlLayout(stateType = typeof(iOSGameControllerState), displayName = "iOS Gamepad")]
[Scripting.Preserve]
public class iOSGameController : Gamepad
{
}
@ -116,7 +115,6 @@ namespace UnityEngine.InputSystem.iOS
/// An Xbox One Bluetooth controller connected to an iOS device.
/// </summary>
[InputControlLayout(stateType = typeof(iOSGameControllerState), displayName = "iOS Xbox One Gamepad")]
[Scripting.Preserve]
public class XboxOneGampadiOS : XInput.XInputController
{
}
@ -125,7 +123,6 @@ namespace UnityEngine.InputSystem.iOS
/// A PlayStation DualShock 4 controller connected to an iOS device.
/// </summary>
[InputControlLayout(stateType = typeof(iOSGameControllerState), displayName = "iOS DualShock 4 Gamepad")]
[Scripting.Preserve]
public class DualShock4GampadiOS : DualShockGamepad
{
}

Просмотреть файл

@ -41,7 +41,7 @@ namespace UnityEngine.InputSystem.iOS.LowLevel
public static FourCC kFormat = new FourCC('I', 'S', 'C', 'S');
public FourCC format => kFormat;
[InputControl(name = "stepCounter")]
[InputControl(name = "stepCounter", layout = "Integer")]
public int stepCounter;
}

Просмотреть файл

@ -631,7 +631,9 @@ PlayerSettings:
il2cppCompilerConfiguration:
Android: 0
managedStrippingLevel:
Android: 3
Standalone: 3
iPhone: 3
incrementalIl2cppBuild: {}
allowUnsafeCode: 1
additionalIl2CppArgs: