Control Scheme#
Input / Control Scheme
Can Read
Cannot Write
Description#
The name of the control scheme the first player is currently using
Code#
using System;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Users;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Get]
[Title("Control Scheme")]
[Category("Input/Control Scheme")]
[Description("The name of the control scheme the first player is currently using")]
[Image(typeof(IconGamepad), ColorTheme.Type.Blue, typeof(BadgeString))]
[Keywords("Player", "User", "Prompt", "Keyboard", "Gamepad")]
[Serializable]
public class TypeStringInputControlScheme : TypeString
{
public override string Get(Args args)
{
foreach (InputUser user in InputUser.all)
{
InputControlScheme? controlScheme = user.controlScheme;
if (controlScheme.HasValue) return controlScheme.Value.name;
}
return string.Empty;
}
public override string ToString()
{
return "Control Scheme";
}
protected override SubscriptionMode Subscription => SubscriptionMode.OnChange;
}
}