Skip to content

Commit 7988c0d

Browse files
Make StateTranslator logging verbose-only
1 parent a08691d commit 7988c0d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Packages/com.thenathannator.plasticband/PlasticBand/LowLevel/StateTranslator.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ private static bool TranslateState(InputDevice device, InputEventPtr eventPtr,
5757
{
5858
if (eventPtr.type != StateEvent.Type)
5959
{
60+
#if UNITY_EDITOR || PLASTICBAND_VERBOSE_LOGGING
6061
Debug.LogError($"Non-state event {eventPtr.type} received on translating device {device}!");
62+
#endif
6163
return false;
6264
}
6365

@@ -66,16 +68,21 @@ private static bool TranslateState(InputDevice device, InputEventPtr eventPtr,
6668
if (stateEvent->stateFormat == ToStateFormat)
6769
return true;
6870

69-
// Ensure the format matches and the buffer is big enough for each state type
71+
// Ensure that the state format matches
7072
if (stateEvent->stateFormat != FromStateFormat)
7173
{
74+
#if UNITY_EDITOR || PLASTICBAND_VERBOSE_LOGGING
7275
Debug.LogError($"Wrong state format {stateEvent->stateFormat} for translating device {device}! Expected {FromStateFormat}");
76+
#endif
7377
return false;
7478
}
7579

80+
// ...and that the buffer is big enough for each state type
7681
if (stateEvent->stateSizeInBytes < sizeof(TFromState) || stateEvent->stateSizeInBytes < sizeof(TToState))
7782
{
83+
#if UNITY_EDITOR || PLASTICBAND_VERBOSE_LOGGING
7884
Debug.LogError($"State size {stateEvent->stateSizeInBytes} for translating device {device} is too small for input size {sizeof(TFromState)} and output size {sizeof(TToState)}!");
85+
#endif
7986
return false;
8087
}
8188

0 commit comments

Comments
 (0)