Add custom control scheme for new input asset

Doesn't work yet with arcade inputs
This commit is contained in:
William Lebel 2023-05-28 16:21:51 -04:00
parent f8890cb25d
commit a5fa34f8b0
20 changed files with 1425 additions and 11 deletions

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f384b751500f6074f844214aa12360b0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2dbc2a9fc657c7c49ad7589198f093e2
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4968396d1c0a1a4409395e0b48e64580
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 2ffaf48f91334e9ab682a5785caa93fc
timeCreated: 1685298626

View File

@ -0,0 +1,339 @@
#if ENABLE_INPUT_SYSTEM
using System;
using System.ComponentModel;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem.LowLevel;
using UnityEngine.InputSystem.Utilities;
using ConjureOS.Input.LowLevel;
using UnityEngine.InputSystem.Users;
using System.Collections.Generic;
using ArrayHelpers = ConjureOS.Input.Utilities.ArrayHelpers;
namespace ConjureOS.Input.Utilities
{
/// <summary>
/// A collection of utility functions for working with arrays.
/// </summary>
/// <remarks>
/// The goal of this collection is to make it easy to use arrays directly rather than resorting to
/// <see cref="List{T}"/>.
/// </remarks>
internal static class ArrayHelpers
{
public static int IndexOfReference<TFirst, TSecond>(this TFirst[] array, TSecond value, int count = -1)
where TSecond : class
where TFirst : TSecond
{
return IndexOfReference(array, value, 0, count);
}
public static int IndexOfReference<TFirst, TSecond>(this TFirst[] array, TSecond value, int startIndex, int count)
where TSecond : class
where TFirst : TSecond
{
if (array == null)
return -1;
if (count < 0)
count = array.Length - startIndex;
for (var i = startIndex; i < startIndex + count; ++i)
if (ReferenceEquals(array[i], value))
return i;
return -1;
}
public static int AppendWithCapacity<TValue>(ref TValue[] array, ref int count, TValue value, int capacityIncrement = 10)
{
if (array == null)
{
array = new TValue[capacityIncrement];
array[0] = value;
++count;
return 0;
}
var capacity = array.Length;
if (capacity == count)
{
capacity += capacityIncrement;
Array.Resize(ref array, capacity);
}
var index = count;
array[index] = value;
++count;
return index;
}
public static void EraseAtWithCapacity<TValue>(this TValue[] array, ref int count, int index)
{
Debug.Assert(array != null);
Debug.Assert(count <= array.Length);
Debug.Assert(index >= 0 && index < count);
// If we're erasing from the beginning or somewhere in the middle, move
// the array contents down from after the index.
if (index < count - 1)
{
Array.Copy(array, index + 1, array, index, count - index - 1);
}
array[count - 1] = default; // Tail has been moved down by one.
--count;
}
}
}
namespace ConjureOS.Input.LowLevel
{
/// <summary>
/// Default state layout for Conjure Arcade controllers.
/// </summary>
/// <seealso cref="ConjureArcadeController"/>
[StructLayout(LayoutKind.Explicit, Size = 28)]
public struct ConjureArcadeControllerState : IInputStateTypeInfo
{
public static FourCC Format => new FourCC('C', 'N', 'J', 'A');
/// <summary>
/// Button bit mask.
/// </summary>
/// <value>Button bit mask.</value>
/// <seealso cref="ConjureArcadeControllerButton"/>
/// <seealso cref="Gamepad.buttonSouth"/>
/// <seealso cref="Gamepad.buttonNorth"/>
/// <seealso cref="Gamepad.buttonWest"/>
/// <seealso cref="Gamepad.buttonSouth"/>
/// <seealso cref="Gamepad.leftShoulder"/>
/// <seealso cref="Gamepad.rightShoulder"/>
/// <seealso cref="Gamepad.startButton"/>
/// <seealso cref="Gamepad.selectButton"/>
[InputControl(name = "buttonA", layout = "Button", bit = (uint)ConjureArcadeControllerButton.ButtonA, displayName = "Button A", shortDisplayName = "A")]
[InputControl(name = "buttonB", layout = "Button", bit = (uint)ConjureArcadeControllerButton.ButtonB, displayName = "Button B", shortDisplayName = "B")]
[InputControl(name = "buttonC", layout = "Button", bit = (uint)ConjureArcadeControllerButton.ButtonC, displayName = "Button C", shortDisplayName = "C")]
[InputControl(name = "button1", layout = "Button", bit = (uint)ConjureArcadeControllerButton.Button1, displayName = "Button 1", shortDisplayName = "1")]
[InputControl(name = "button2", layout = "Button", bit = (uint)ConjureArcadeControllerButton.Button2, displayName = "Button 2", shortDisplayName = "2")]
[InputControl(name = "button3", layout = "Button", bit = (uint)ConjureArcadeControllerButton.Button3, displayName = "Button 3", shortDisplayName = "3")]
[InputControl(name = "buttonStart", layout = "Button", bit = (uint)ConjureArcadeControllerButton.ButtonStart, usages = new[] { "Join", "Pause" }, displayName = "Button Start", shortDisplayName = "Start")]
[InputControl(name = "buttonPower", layout = "Button", bit = (uint)ConjureArcadeControllerButton.ButtonPower, usages = new[] { "Power", "Exit" }, displayName = "Button Power", shortDisplayName = "Power")]
[FieldOffset(0)]
public uint buttons;
/// <summary>
/// Stick position. Each axis goes from -1 to 1 with
/// 0 being center position.
/// </summary>
/// <value>Left stick position.</value>
/// <seealso cref="ConjureArcadeController.stick"/>
[InputControl(layout = "Stick", usage = "Primary2DMotion", processors = "stickDeadzone", displayName = "Stick", shortDisplayName = "S")]
[FieldOffset(4)]
public Vector2 stick;
/// <summary>
/// State format tag for GamepadState.
/// </summary>
/// <value>Returns "CNJA".</value>
public FourCC format => Format;
/// <summary>
/// Create a gamepad state with the given buttons being pressed.
/// </summary>
/// <param name="buttons">Buttons to put into pressed state.</param>
/// <exception cref="ArgumentNullException"><paramref name="buttons"/> is <c>null</c>.</exception>
public ConjureArcadeControllerState(params GamepadButton[] buttons)
: this()
{
if (buttons == null)
throw new ArgumentNullException(nameof(buttons));
foreach (var button in buttons)
{
Debug.Assert((int)button < 32, $"Expected button < 32, so we fit into the 32 bit wide bitmask");
var bit = 1U << (int)button;
this.buttons |= bit;
}
}
/// <summary>
/// Set the specific buttons to be pressed or unpressed.
/// </summary>
/// <param name="button">A gamepad button.</param>
/// <param name="value">Whether to set <paramref name="button"/> to be pressed or not pressed in
/// <see cref="buttons"/>.</param>
/// <returns>GamepadState with a modified <see cref="buttons"/> mask.</returns>
public ConjureArcadeControllerState WithButton(GamepadButton button, bool value = true)
{
Debug.Assert((int)button < 32, $"Expected button < 32, so we fit into the 32 bit wide bitmask");
var bit = 1U << (int)button;
if (value)
buttons |= bit;
else
buttons &= ~bit;
return this;
}
}
public enum ConjureArcadeControllerButton
{
ButtonA = 0,
ButtonB = 1,
ButtonC = 2,
Button1 = 3,
Button2 = 4,
Button3 = 5,
ButtonStart = 6,
ButtonPower = 7,
}
}
namespace ConjureOS.Input
{
[InputControlLayout(stateType = typeof(ConjureArcadeControllerState), displayName = "Conjure Arcade Controller")]
public class ConjureArcadeController : InputDevice
{
public ButtonControl buttonA { get; protected set; }
public ButtonControl buttonB { get; protected set; }
public ButtonControl buttonC { get; protected set; }
public ButtonControl button1 { get; protected set; }
public ButtonControl button2 { get; protected set; }
public ButtonControl button3 { get; protected set; }
public ButtonControl buttonStart { get; protected set; }
public ButtonControl buttonPower { get; protected set; }
public StickControl stick { get; protected set; }
/// <summary>
/// Retrieve a gamepad button by its <see cref="ConjureArcadeControllerButton"/> enumeration
/// constant.
/// </summary>
/// <param name="button">Button to retrieve.</param>
/// <exception cref="ArgumentException"><paramref name="button"/> is not a valid gamepad
/// button value.</exception>
public ButtonControl this[ConjureArcadeControllerButton button]
{
get
{
switch (button)
{
case ConjureArcadeControllerButton.ButtonA: return buttonA;
case ConjureArcadeControllerButton.ButtonB: return buttonB;
case ConjureArcadeControllerButton.ButtonC: return buttonC;
case ConjureArcadeControllerButton.Button1: return button1;
case ConjureArcadeControllerButton.Button2: return button2;
case ConjureArcadeControllerButton.Button3: return button3;
case ConjureArcadeControllerButton.ButtonStart: return buttonStart;
case ConjureArcadeControllerButton.ButtonPower: return buttonPower;
default:
throw new InvalidEnumArgumentException(nameof(button), (int)button, typeof(GamepadButton));
}
}
}
/// <summary>
/// The gamepad last used/connected by the player or <c>null</c> if there is no gamepad connected
/// to the system.
/// </summary>
/// <remarks>
/// When added, a device is automatically made current (see <see cref="InputDevice.MakeCurrent"/>), so
/// when connecting a gamepad, it will also become current. After that, it will only become current again
/// when input change on non-noisy controls (see <see cref="InputControl.noisy"/>) is received.
///
/// For local multiplayer scenarios (or whenever there are multiple gamepads that need to be usable
/// in a concurrent fashion), it is not recommended to rely on this property. Instead, it is recommended
/// to use <see cref="PlayerInput"/> or <see cref="InputUser"/>.
/// </remarks>
/// <seealso cref="InputDevice.MakeCurrent"/>
/// <seealso cref="all"/>
public static ConjureArcadeController current { get; private set; }
/// <summary>
/// A list of gamepads currently connected to the system.
/// </summary>
/// <value>All currently connected gamepads.</value>
/// <remarks>
/// Does not cause GC allocation.
///
/// Do <em>not</em> hold on to the value returned by this getter but rather query it whenever
/// you need it. Whenever the gamepad setup changes, the value returned by this getter
/// is invalidated.
/// </remarks>
/// <seealso cref="current"/>
public new static ReadOnlyArray<ConjureArcadeController> all => new(s_Gamepads, 0, s_GamepadCount);
/// <inheritdoc />
protected override void FinishSetup()
{
buttonA = GetChildControl<ButtonControl>("buttonA");
buttonB = GetChildControl<ButtonControl>("buttonB");
buttonC = GetChildControl<ButtonControl>("buttonC");
button1 = GetChildControl<ButtonControl>("button1");
button2 = GetChildControl<ButtonControl>("button2");
button3 = GetChildControl<ButtonControl>("button3");
buttonStart = GetChildControl<ButtonControl>("buttonStart");
buttonPower = GetChildControl<ButtonControl>("buttonPower");
stick = GetChildControl<StickControl>("stick");
base.FinishSetup();
}
/// <summary>
/// Make the gamepad the <see cref="current"/> gamepad.
/// </summary>
/// <remarks>
/// This is called automatically by the system when there is input on a gamepad.
/// </remarks>
public override void MakeCurrent()
{
base.MakeCurrent();
current = this;
}
/// <summary>
/// Called when the gamepad is added to the system.
/// </summary>
protected override void OnAdded()
{
ArrayHelpers.AppendWithCapacity(ref s_Gamepads, ref s_GamepadCount, this);
}
/// <summary>
/// Called when the gamepad is removed from the system.
/// </summary>
protected override void OnRemoved()
{
if (current == this)
current = null;
// Remove from `all`.
var index = ArrayHelpers.IndexOfReference(s_Gamepads, this, s_GamepadCount);
if (index != -1)
ArrayHelpers.EraseAtWithCapacity(s_Gamepads, ref s_GamepadCount, index);
else
{
Debug.Assert(false,
$"Gamepad {this} seems to not have been added but is being removed (gamepad list: {string.Join(", ", all)})"); // Put in else to not allocate on normal path.
}
}
private static int s_GamepadCount;
private static ConjureArcadeController[] s_Gamepads;
}
}
#endif

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e62e8126e50e4fd2b062c6a83533560e
timeCreated: 1685298675

View File

@ -0,0 +1,30 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.InputSystem.Layouts;
using UnityEngine.InputSystem;
namespace ConjureOS.Input
{
#if UNITY_EDITOR
[InitializeOnLoad] // Call static class constructor in editor.
#endif
static public class ConjureInputSystem
{
static ConjureInputSystem()
{
Debug.Log("Mamamiiiiia");
#if UNITY_EDITOR
InitializeInEditor();
#endif
}
static void InitializeInEditor()
{
#if UNITY_EDITOR && ENABLE_INPUT_SYSTEM
InputSystem.RegisterLayout<ConjureArcadeController>(
matches: new InputDeviceMatcher()
.WithInterface("ConjureArcadeController"));
#endif
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 30d9c0af719248758be0853447bb0b6f
timeCreated: 1685303377

View File

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 705507994} m_Sun: {fileID: 705507994}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
m_UseRadianceAmbientProbe: 0 m_UseRadianceAmbientProbe: 0
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
@ -118,6 +118,8 @@ NavMeshSettings:
manualTileSize: 0 manualTileSize: 0
tileSize: 256 tileSize: 256
accuratePlacement: 0 accuratePlacement: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
@ -125,7 +127,8 @@ NavMeshSettings:
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 705507995} - component: {fileID: 705507995}
@ -141,15 +144,18 @@ GameObject:
Light: Light:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705507993} m_GameObject: {fileID: 705507993}
m_Enabled: 1 m_Enabled: 1
serializedVersion: 8 serializedVersion: 10
m_Type: 1 m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1 m_Intensity: 1
m_Range: 10 m_Range: 10
m_SpotAngle: 30 m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_CookieSize: 10 m_CookieSize: 10
m_Shadows: m_Shadows:
m_Type: 2 m_Type: 2
@ -159,6 +165,24 @@ Light:
m_Bias: 0.05 m_Bias: 0.05
m_NormalBias: 0.4 m_NormalBias: 0.4
m_NearPlane: 0.2 m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0} m_Cookie: {fileID: 0}
m_DrawHalo: 0 m_DrawHalo: 0
m_Flare: {fileID: 0} m_Flare: {fileID: 0}
@ -166,23 +190,29 @@ Light:
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 1 m_Lightmapping: 1
m_LightShadowCasterMode: 0 m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1} m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1 m_BounceIntensity: 1
m_ColorTemperature: 6570 m_ColorTemperature: 6570
m_UseColorTemperature: 0 m_UseColorTemperature: 0
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0 m_ShadowRadius: 0
m_ShadowAngle: 0 m_ShadowAngle: 0
--- !u!4 &705507995 --- !u!4 &705507995
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705507993} m_GameObject: {fileID: 705507993}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0} m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 1 m_RootOrder: 1
@ -191,7 +221,8 @@ Transform:
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 963194228} - component: {fileID: 963194228}
@ -208,23 +239,26 @@ GameObject:
AudioListener: AudioListener:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225} m_GameObject: {fileID: 963194225}
m_Enabled: 1 m_Enabled: 1
--- !u!20 &963194227 --- !u!20 &963194227
Camera: Camera:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225} m_GameObject: {fileID: 963194225}
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_ClearFlags: 1 m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1 m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24} m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0} m_LensShift: {x: 0, y: 0}
m_GateFitMode: 2
m_FocalLength: 50 m_FocalLength: 50
m_NormalizedViewPortRect: m_NormalizedViewPortRect:
serializedVersion: 2 serializedVersion: 2
@ -256,12 +290,58 @@ Camera:
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225} m_GameObject: {fileID: 963194225}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1, z: -10} m_LocalPosition: {x: 0, y: 1, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1522364153
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1522364155}
- component: {fileID: 1522364154}
m_Layer: 0
m_Name: Testo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1522364154
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1522364153}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c0e6fe775cd2edd45944811c411d4dde, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1522364155
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1522364153}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.8084364, y: -1.0925081, z: -10.868857}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

8
Assets/Test-Input.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1962d2e88e914bd4fb1f59490b888101
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

424
Assets/Test-Input/Test.cs Normal file
View File

@ -0,0 +1,424 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
// version 1.4.4
// from Assets/Test-Input/Test.inputactions
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Utilities;
public partial class @TheTestInputs : IInputActionCollection2, IDisposable
{
public InputActionAsset asset { get; }
public @TheTestInputs()
{
asset = InputActionAsset.FromJson(@"{
""name"": ""Test"",
""maps"": [
{
""name"": ""Test"",
""id"": ""8c830899-5b93-4485-b6cf-690688a32987"",
""actions"": [
{
""name"": ""PressButton1"",
""type"": ""Button"",
""id"": ""7fc97698-5a30-4ede-b705-3089212e33a4"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""PressButton2"",
""type"": ""Button"",
""id"": ""36279e50-c398-4905-a495-8c9a0c7ea6a0"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""PressButton3"",
""type"": ""Button"",
""id"": ""5e4a401d-31b5-4238-be45-fcb742db8257"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""PressButtonA"",
""type"": ""Button"",
""id"": ""282753cf-d354-460a-b3d8-897b57100e1c"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""PressButtonB"",
""type"": ""Button"",
""id"": ""bcb4b7cb-c447-4222-8b17-021f5992da49"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""PressButtonC"",
""type"": ""Button"",
""id"": ""72e5810c-02b1-45de-a7a9-e0732cc11a84"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""PressButtonStart"",
""type"": ""Button"",
""id"": ""85317456-76d2-423e-bfbe-4c59f9412c30"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""PressButtonPower"",
""type"": ""Button"",
""id"": ""5e2022da-d536-4c6d-b997-9b9005b5fcc1"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": false
},
{
""name"": ""Move"",
""type"": ""Value"",
""id"": ""1efea12d-0e62-4272-98f2-419a3972b23e"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """",
""initialStateCheck"": true
}
],
""bindings"": [
{
""name"": """",
""id"": ""1b6d6e5f-df9e-4700-b09a-58d03a083c57"",
""path"": ""<ConjureArcadeController>/button1"",
""interactions"": """",
""processors"": """",
""groups"": ""New control scheme"",
""action"": ""PressButton1"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""52815d9a-0ebf-48b6-ae4f-0db59a5e0785"",
""path"": ""<Keyboard>/l"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""PressButton1"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""dd68c926-eaf2-402d-a3dc-c0c0e5278960"",
""path"": ""<ConjureArcadeController>/button2"",
""interactions"": """",
""processors"": """",
""groups"": ""New control scheme"",
""action"": ""PressButton2"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""c4ec34c3-a5b5-4d25-951d-2c4e9ae5567f"",
""path"": ""<ConjureArcadeController>/button3"",
""interactions"": """",
""processors"": """",
""groups"": ""New control scheme"",
""action"": ""PressButton3"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""5d36faa3-e6f9-4d7e-a708-8fa196d0bfa2"",
""path"": ""<ConjureArcadeController>/buttonA"",
""interactions"": """",
""processors"": """",
""groups"": ""New control scheme"",
""action"": ""PressButtonA"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""a7c51fe1-33ec-4c06-9cec-0f45917c7347"",
""path"": ""<ConjureArcadeController>/buttonB"",
""interactions"": """",
""processors"": """",
""groups"": ""New control scheme"",
""action"": ""PressButtonB"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""e580378c-77e5-413f-9dff-8b10adca2e64"",
""path"": ""<ConjureArcadeController>/buttonC"",
""interactions"": """",
""processors"": """",
""groups"": ""New control scheme"",
""action"": ""PressButtonC"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""a7d5c7a7-7684-4f91-b0f1-c27cf506a3f6"",
""path"": ""<ConjureArcadeController>/buttonStart"",
""interactions"": """",
""processors"": """",
""groups"": ""New control scheme"",
""action"": ""PressButtonStart"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""3cd16b1e-35e3-4be2-9e3e-e68a8470ba76"",
""path"": ""<ConjureArcadeController>/buttonPower"",
""interactions"": """",
""processors"": """",
""groups"": ""New control scheme"",
""action"": ""PressButtonPower"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""7628f7a3-2ff4-41b8-8f72-a8c723238dff"",
""path"": ""<ConjureArcadeController>/stick"",
""interactions"": """",
""processors"": """",
""groups"": """",
""action"": ""Move"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
],
""controlSchemes"": [
{
""name"": ""New control scheme"",
""bindingGroup"": ""New control scheme"",
""devices"": [
{
""devicePath"": ""<ConjureArcadeController>"",
""isOptional"": false,
""isOR"": false
}
]
}
]
}");
// Test
m_Test = asset.FindActionMap("Test", throwIfNotFound: true);
m_Test_PressButton1 = m_Test.FindAction("PressButton1", throwIfNotFound: true);
m_Test_PressButton2 = m_Test.FindAction("PressButton2", throwIfNotFound: true);
m_Test_PressButton3 = m_Test.FindAction("PressButton3", throwIfNotFound: true);
m_Test_PressButtonA = m_Test.FindAction("PressButtonA", throwIfNotFound: true);
m_Test_PressButtonB = m_Test.FindAction("PressButtonB", throwIfNotFound: true);
m_Test_PressButtonC = m_Test.FindAction("PressButtonC", throwIfNotFound: true);
m_Test_PressButtonStart = m_Test.FindAction("PressButtonStart", throwIfNotFound: true);
m_Test_PressButtonPower = m_Test.FindAction("PressButtonPower", throwIfNotFound: true);
m_Test_Move = m_Test.FindAction("Move", throwIfNotFound: true);
}
public void Dispose()
{
UnityEngine.Object.Destroy(asset);
}
public InputBinding? bindingMask
{
get => asset.bindingMask;
set => asset.bindingMask = value;
}
public ReadOnlyArray<InputDevice>? devices
{
get => asset.devices;
set => asset.devices = value;
}
public ReadOnlyArray<InputControlScheme> controlSchemes => asset.controlSchemes;
public bool Contains(InputAction action)
{
return asset.Contains(action);
}
public IEnumerator<InputAction> GetEnumerator()
{
return asset.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public void Enable()
{
asset.Enable();
}
public void Disable()
{
asset.Disable();
}
public IEnumerable<InputBinding> bindings => asset.bindings;
public InputAction FindAction(string actionNameOrId, bool throwIfNotFound = false)
{
return asset.FindAction(actionNameOrId, throwIfNotFound);
}
public int FindBinding(InputBinding bindingMask, out InputAction action)
{
return asset.FindBinding(bindingMask, out action);
}
// Test
private readonly InputActionMap m_Test;
private ITestActions m_TestActionsCallbackInterface;
private readonly InputAction m_Test_PressButton1;
private readonly InputAction m_Test_PressButton2;
private readonly InputAction m_Test_PressButton3;
private readonly InputAction m_Test_PressButtonA;
private readonly InputAction m_Test_PressButtonB;
private readonly InputAction m_Test_PressButtonC;
private readonly InputAction m_Test_PressButtonStart;
private readonly InputAction m_Test_PressButtonPower;
private readonly InputAction m_Test_Move;
public struct TestActions
{
private @TheTestInputs m_Wrapper;
public TestActions(@TheTestInputs wrapper) { m_Wrapper = wrapper; }
public InputAction @PressButton1 => m_Wrapper.m_Test_PressButton1;
public InputAction @PressButton2 => m_Wrapper.m_Test_PressButton2;
public InputAction @PressButton3 => m_Wrapper.m_Test_PressButton3;
public InputAction @PressButtonA => m_Wrapper.m_Test_PressButtonA;
public InputAction @PressButtonB => m_Wrapper.m_Test_PressButtonB;
public InputAction @PressButtonC => m_Wrapper.m_Test_PressButtonC;
public InputAction @PressButtonStart => m_Wrapper.m_Test_PressButtonStart;
public InputAction @PressButtonPower => m_Wrapper.m_Test_PressButtonPower;
public InputAction @Move => m_Wrapper.m_Test_Move;
public InputActionMap Get() { return m_Wrapper.m_Test; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled => Get().enabled;
public static implicit operator InputActionMap(TestActions set) { return set.Get(); }
public void SetCallbacks(ITestActions instance)
{
if (m_Wrapper.m_TestActionsCallbackInterface != null)
{
@PressButton1.started -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButton1;
@PressButton1.performed -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButton1;
@PressButton1.canceled -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButton1;
@PressButton2.started -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButton2;
@PressButton2.performed -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButton2;
@PressButton2.canceled -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButton2;
@PressButton3.started -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButton3;
@PressButton3.performed -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButton3;
@PressButton3.canceled -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButton3;
@PressButtonA.started -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonA;
@PressButtonA.performed -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonA;
@PressButtonA.canceled -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonA;
@PressButtonB.started -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonB;
@PressButtonB.performed -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonB;
@PressButtonB.canceled -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonB;
@PressButtonC.started -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonC;
@PressButtonC.performed -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonC;
@PressButtonC.canceled -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonC;
@PressButtonStart.started -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonStart;
@PressButtonStart.performed -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonStart;
@PressButtonStart.canceled -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonStart;
@PressButtonPower.started -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonPower;
@PressButtonPower.performed -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonPower;
@PressButtonPower.canceled -= m_Wrapper.m_TestActionsCallbackInterface.OnPressButtonPower;
@Move.started -= m_Wrapper.m_TestActionsCallbackInterface.OnMove;
@Move.performed -= m_Wrapper.m_TestActionsCallbackInterface.OnMove;
@Move.canceled -= m_Wrapper.m_TestActionsCallbackInterface.OnMove;
}
m_Wrapper.m_TestActionsCallbackInterface = instance;
if (instance != null)
{
@PressButton1.started += instance.OnPressButton1;
@PressButton1.performed += instance.OnPressButton1;
@PressButton1.canceled += instance.OnPressButton1;
@PressButton2.started += instance.OnPressButton2;
@PressButton2.performed += instance.OnPressButton2;
@PressButton2.canceled += instance.OnPressButton2;
@PressButton3.started += instance.OnPressButton3;
@PressButton3.performed += instance.OnPressButton3;
@PressButton3.canceled += instance.OnPressButton3;
@PressButtonA.started += instance.OnPressButtonA;
@PressButtonA.performed += instance.OnPressButtonA;
@PressButtonA.canceled += instance.OnPressButtonA;
@PressButtonB.started += instance.OnPressButtonB;
@PressButtonB.performed += instance.OnPressButtonB;
@PressButtonB.canceled += instance.OnPressButtonB;
@PressButtonC.started += instance.OnPressButtonC;
@PressButtonC.performed += instance.OnPressButtonC;
@PressButtonC.canceled += instance.OnPressButtonC;
@PressButtonStart.started += instance.OnPressButtonStart;
@PressButtonStart.performed += instance.OnPressButtonStart;
@PressButtonStart.canceled += instance.OnPressButtonStart;
@PressButtonPower.started += instance.OnPressButtonPower;
@PressButtonPower.performed += instance.OnPressButtonPower;
@PressButtonPower.canceled += instance.OnPressButtonPower;
@Move.started += instance.OnMove;
@Move.performed += instance.OnMove;
@Move.canceled += instance.OnMove;
}
}
}
public TestActions @Test => new TestActions(this);
private int m_NewcontrolschemeSchemeIndex = -1;
public InputControlScheme NewcontrolschemeScheme
{
get
{
if (m_NewcontrolschemeSchemeIndex == -1) m_NewcontrolschemeSchemeIndex = asset.FindControlSchemeIndex("New control scheme");
return asset.controlSchemes[m_NewcontrolschemeSchemeIndex];
}
}
public interface ITestActions
{
void OnPressButton1(InputAction.CallbackContext context);
void OnPressButton2(InputAction.CallbackContext context);
void OnPressButton3(InputAction.CallbackContext context);
void OnPressButtonA(InputAction.CallbackContext context);
void OnPressButtonB(InputAction.CallbackContext context);
void OnPressButtonC(InputAction.CallbackContext context);
void OnPressButtonStart(InputAction.CallbackContext context);
void OnPressButtonPower(InputAction.CallbackContext context);
void OnMove(InputAction.CallbackContext context);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1679088dcfad616499e8a56947eb4fe5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,217 @@
{
"name": "Test",
"maps": [
{
"name": "Test",
"id": "8c830899-5b93-4485-b6cf-690688a32987",
"actions": [
{
"name": "PressButton1",
"type": "Button",
"id": "7fc97698-5a30-4ede-b705-3089212e33a4",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "PressButton2",
"type": "Button",
"id": "36279e50-c398-4905-a495-8c9a0c7ea6a0",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "PressButton3",
"type": "Button",
"id": "5e4a401d-31b5-4238-be45-fcb742db8257",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "PressButtonA",
"type": "Button",
"id": "282753cf-d354-460a-b3d8-897b57100e1c",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "PressButtonB",
"type": "Button",
"id": "bcb4b7cb-c447-4222-8b17-021f5992da49",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "PressButtonC",
"type": "Button",
"id": "72e5810c-02b1-45de-a7a9-e0732cc11a84",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "PressButtonStart",
"type": "Button",
"id": "85317456-76d2-423e-bfbe-4c59f9412c30",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "PressButtonPower",
"type": "Button",
"id": "5e2022da-d536-4c6d-b997-9b9005b5fcc1",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "Move",
"type": "Value",
"id": "1efea12d-0e62-4272-98f2-419a3972b23e",
"expectedControlType": "Vector2",
"processors": "",
"interactions": "",
"initialStateCheck": true
}
],
"bindings": [
{
"name": "",
"id": "1b6d6e5f-df9e-4700-b09a-58d03a083c57",
"path": "<ConjureArcadeController>/button1",
"interactions": "",
"processors": "",
"groups": "New control scheme",
"action": "PressButton1",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "52815d9a-0ebf-48b6-ae4f-0db59a5e0785",
"path": "<Keyboard>/l",
"interactions": "",
"processors": "",
"groups": "",
"action": "PressButton1",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "dd68c926-eaf2-402d-a3dc-c0c0e5278960",
"path": "<ConjureArcadeController>/button2",
"interactions": "",
"processors": "",
"groups": "New control scheme",
"action": "PressButton2",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "c4ec34c3-a5b5-4d25-951d-2c4e9ae5567f",
"path": "<ConjureArcadeController>/button3",
"interactions": "",
"processors": "",
"groups": "New control scheme",
"action": "PressButton3",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "5d36faa3-e6f9-4d7e-a708-8fa196d0bfa2",
"path": "<ConjureArcadeController>/buttonA",
"interactions": "",
"processors": "",
"groups": "New control scheme",
"action": "PressButtonA",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "a7c51fe1-33ec-4c06-9cec-0f45917c7347",
"path": "<ConjureArcadeController>/buttonB",
"interactions": "",
"processors": "",
"groups": "New control scheme",
"action": "PressButtonB",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "e580378c-77e5-413f-9dff-8b10adca2e64",
"path": "<ConjureArcadeController>/buttonC",
"interactions": "",
"processors": "",
"groups": "New control scheme",
"action": "PressButtonC",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "a7d5c7a7-7684-4f91-b0f1-c27cf506a3f6",
"path": "<ConjureArcadeController>/buttonStart",
"interactions": "",
"processors": "",
"groups": "New control scheme",
"action": "PressButtonStart",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "3cd16b1e-35e3-4be2-9e3e-e68a8470ba76",
"path": "<ConjureArcadeController>/buttonPower",
"interactions": "",
"processors": "",
"groups": "New control scheme",
"action": "PressButtonPower",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "7628f7a3-2ff4-41b8-8f72-a8c723238dff",
"path": "<ConjureArcadeController>/stick",
"interactions": "",
"processors": "",
"groups": "",
"action": "Move",
"isComposite": false,
"isPartOfComposite": false
}
]
}
],
"controlSchemes": [
{
"name": "New control scheme",
"bindingGroup": "New control scheme",
"devices": [
{
"devicePath": "<ConjureArcadeController>",
"isOptional": false,
"isOR": false
}
]
}
]
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: ff3eb4b73c9b6b9449ed441e5eb03514
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
generateWrapperCode: 1
wrapperCodePath:
wrapperClassName: TheTestInputs
wrapperCodeNamespace:

View File

@ -0,0 +1,70 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class TestInputBehavior : MonoBehaviour
{
private TheTestInputs inputActionAsset;
void Start()
{
inputActionAsset = new TheTestInputs();
inputActionAsset.Test.PressButtonA.performed += PressButtonA;
inputActionAsset.Test.PressButtonB.performed += PressButtonB;
inputActionAsset.Test.PressButtonC.performed += PressButtonC;
inputActionAsset.Test.PressButton1.performed += PressButton1;
inputActionAsset.Test.PressButton2.performed += PressButton2;
inputActionAsset.Test.PressButton3.performed += PressButton3;
inputActionAsset.Test.PressButtonStart.performed += PressButtonStart;
inputActionAsset.Test.PressButtonPower.performed += PressButtonPower;
inputActionAsset.Test.Move.performed += UseJoystick;
}
void PressButtonA(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button A");
}
void PressButtonB(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button B");
}
void PressButtonC(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button C");
}
void PressButton1(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button 1");
}
void PressButton2(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button 2");
}
void PressButton3(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button 3");
}
void PressButtonStart(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button start");
}
void PressButtonPower(InputAction.CallbackContext callbackContext)
{
Debug.Log("Button power");
}
void UseJoystick(InputAction.CallbackContext callbackContext)
{
Vector2 direction = callbackContext.ReadValue<Vector2>();
Debug.Log($"Joystick: {direction}");
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c0e6fe775cd2edd45944811c411d4dde
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -5,6 +5,7 @@
"com.unity.ide.rider": "3.0.18", "com.unity.ide.rider": "3.0.18",
"com.unity.ide.visualstudio": "2.0.17", "com.unity.ide.visualstudio": "2.0.17",
"com.unity.ide.vscode": "1.2.5", "com.unity.ide.vscode": "1.2.5",
"com.unity.inputsystem": "1.4.4",
"com.unity.test-framework": "1.1.31", "com.unity.test-framework": "1.1.31",
"com.unity.textmeshpro": "3.0.6", "com.unity.textmeshpro": "3.0.6",
"com.unity.timeline": "1.6.4", "com.unity.timeline": "1.6.4",

View File

@ -60,6 +60,15 @@
"dependencies": {}, "dependencies": {},
"url": "https://packages.unity.com" "url": "https://packages.unity.com"
}, },
"com.unity.inputsystem": {
"version": "1.4.4",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.modules.uielements": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.performance.profile-analyzer": { "com.unity.performance.profile-analyzer": {
"version": "1.1.1", "version": "1.1.1",
"depth": 1, "depth": 1,

View File

@ -704,7 +704,7 @@ PlayerSettings:
m_VersionCode: 1 m_VersionCode: 1
m_VersionName: m_VersionName:
apiCompatibilityLevel: 6 apiCompatibilityLevel: 6
activeInputHandler: 0 activeInputHandler: 2
windowsGamepadBackendHint: 0 windowsGamepadBackendHint: 0
cloudProjectId: cloudProjectId:
framebufferDepthMemorylessMode: 0 framebufferDepthMemorylessMode: 0

View File

@ -0,0 +1,167 @@
{
"templatePinStates": [],
"dependencyTypeInfos": [
{
"userAdded": false,
"type": "UnityEngine.AnimationClip",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEditor.Animations.AnimatorController",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.AnimatorOverrideController",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEditor.Audio.AudioMixerController",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.ComputeShader",
"ignore": true,
"defaultInstantiationMode": 1,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.Cubemap",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.GameObject",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEditor.LightingDataAsset",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": false
},
{
"userAdded": false,
"type": "UnityEngine.LightingSettings",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.Material",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEditor.MonoScript",
"ignore": true,
"defaultInstantiationMode": 1,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.PhysicMaterial",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.PhysicsMaterial2D",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.Rendering.PostProcessing.PostProcessResources",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.Rendering.VolumeProfile",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEditor.SceneAsset",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": false
},
{
"userAdded": false,
"type": "UnityEngine.Shader",
"ignore": true,
"defaultInstantiationMode": 1,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.ShaderVariantCollection",
"ignore": true,
"defaultInstantiationMode": 1,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.Texture",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.Texture2D",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
},
{
"userAdded": false,
"type": "UnityEngine.Timeline.TimelineAsset",
"ignore": false,
"defaultInstantiationMode": 0,
"supportsModification": true
}
],
"defaultDependencyTypeInfo": {
"userAdded": false,
"type": "<default_scene_template_dependencies>",
"ignore": false,
"defaultInstantiationMode": 1,
"supportsModification": true
},
"newSceneOverride": 0
}