A game about forced loneliness, made by TACStudios
1#if PACKAGE_INPUT_SYSTEM_EXISTS
2using System.Collections.Generic;
3using Unity.VisualScripting.InputSystem;
4using UnityEngine.InputSystem;
5
6namespace Unity.VisualScripting
7{
8 [Analyser(typeof(OnInputSystemEvent))]
9 public class OnInputSystemEventAnalyser : UnitAnalyser<OnInputSystemEvent>
10 {
11 public OnInputSystemEventAnalyser(GraphReference reference, OnInputSystemEvent target) : base(reference, target) {}
12
13 protected override IEnumerable<Warning> Warnings()
14 {
15 foreach (var baseWarning in base.Warnings())
16 yield return baseWarning;
17
18 if (target.InputActionChangeType == InputActionChangeOption.OnHold ||
19 target.InputActionChangeType == InputActionChangeOption.OnReleased)
20 {
21 if (Flow.CanPredict(target.InputAction, reference))
22 {
23 var inputAction = Flow.Predict<InputAction>(target.InputAction, reference);
24 if (inputAction.type == InputActionType.PassThrough)
25 yield return Warning.Caution($"Input action '{inputAction.name}' is of type 'Passthrough', which do not support 'On Hold' or 'On Released' events");
26 }
27 }
28 }
29 }
30}
31#endif