Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

New PointerInputModule wont allow Keyboard input when piggybacking off Standalone Input Module

Discussion in 'Scripting' started by RedRiverStudio, Apr 19, 2016.

  1. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
    HI guys,
    Ive hit my scripting knowledge limit on this one. I have hacked up the touch input module to include a worldspace cursor. This is piggybacking on the Rewired Standalone Input Module. When using my cursor, I can move, drag, click, etc, everything works fine, but when I get into an Input Field, the keyboard does not respond.

    Code (CSharp):
    1. using System.Text;
    2. using Rewired;
    3. using System.Collections.Generic;
    4.  
    5. namespace UnityEngine.EventSystems
    6. {
    7.     [AddComponentMenu("Event/Touch Input Module")]
    8.     public class V_TouchInputModule : PointerInputModule
    9.     {
    10.         protected V_TouchInputModule()
    11.         { }
    12.         private Vector2 cursorHist;
    13.  
    14.         [SerializeField]
    15.         private PointerEventData pointerEventData;
    16.  
    17.         public string m_SubmitButton = "UISubmit";
    18.         public CanvasMouse cursor;
    19.         public bool moving = true;
    20.  
    21.         public override bool IsModuleSupported()
    22.         {
    23.             return true;
    24.         }
    25.        
    26.         public override bool ShouldActivateModule()
    27.         {
    28.             if (!base.ShouldActivateModule())
    29.                 return false;
    30.             return true;
    31.  
    32.         }
    33.  
    34.         public override void Process()
    35.         {
    36.             cursorProcess();
    37.  
    38.         }
    39.  
    40.         private void cursorProcess()
    41.         {
    42.             //Cursor
    43.             if(!cursor){return;}
    44.  
    45.             //if(!moving){return;}
    46.             if (pointerEventData == null){pointerEventData = new PointerEventData(eventSystem);}
    47.            
    48.             // cursor to element
    49.             Rewired.Player player = ReInput.players.GetPlayer(0);
    50.             bool dragging = player.GetButton(m_SubmitButton) || Input.GetMouseButton(0);
    51.             bool releasing = player.GetButtonUp(m_SubmitButton) || Input.GetMouseButtonUp(0);
    52.             bool clicking = player.GetButtonDown(m_SubmitButton) || Input.GetMouseButtonDown(0);
    53.  
    54.             moving = ((cursor.screenpoint - cursorHist != Vector2.zero) || dragging || clicking);
    55.  
    56.             pointerEventData.position = cursor.screenpoint;
    57.             pointerEventData.delta = cursor.screenpoint - cursorHist;
    58.             cursorHist = cursor.screenpoint;
    59.             List<RaycastResult> raycastResults = new List<RaycastResult>();
    60.             eventSystem.RaycastAll(pointerEventData, raycastResults);
    61.             pointerEventData.pointerCurrentRaycast = FindFirstRaycast(raycastResults);
    62.  
    63.             if (clicking){
    64.                 dragging = false;
    65.                 pointerEventData.delta = Vector2.zero;
    66.             }
    67.             pointerEventData.dragging = dragging;
    68.             pointerEventData.useDragThreshold = false;
    69.             pointerEventData.pointerEnter = eventSystem.currentSelectedGameObject;
    70.  
    71.             ProcessTouchPress(pointerEventData, clicking, releasing);
    72.            
    73.             // only process move if we are pressed...
    74.             ProcessMove(pointerEventData);
    75.             if (dragging)
    76.             {
    77.                 ProcessDrag(pointerEventData);
    78.             }
    79.         }
    80.  
    81.         private void ProcessTouchPress(PointerEventData pointerEvent, bool pressed, bool released)
    82.         {
    83.             var currentOverGo = pointerEvent.pointerCurrentRaycast.gameObject;
    84.             DeselectIfSelectionChanged(currentOverGo, pointerEvent);
    85.             // PointerDown notification
    86.             if (pressed)
    87.             {
    88.                 pointerEvent.eligibleForClick = true;
    89.                 pointerEvent.delta = Vector2.zero;
    90.                 pointerEvent.dragging = false;
    91.                 pointerEvent.useDragThreshold = true;
    92.                 pointerEvent.pressPosition = pointerEvent.position;
    93.                 pointerEvent.pointerPressRaycast = pointerEvent.pointerCurrentRaycast;
    94.  
    95.                 if (pointerEvent.pointerEnter != currentOverGo)
    96.                 {
    97.                     // send a pointer enter to the touched element if it isn't the one to select...
    98.                     HandlePointerExitAndEnter(pointerEvent, currentOverGo);
    99.                     pointerEvent.pointerEnter = currentOverGo;
    100.                 }
    101.  
    102.                 var newPressed = ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.pointerDownHandler);
    103.                
    104.                 if (newPressed == null)
    105.                     newPressed = ExecuteEvents.GetEventHandler<IPointerClickHandler>(currentOverGo);
    106.                
    107.                 float time = Time.unscaledTime;
    108.                
    109.                 if (newPressed == pointerEvent.lastPress)
    110.                 {
    111.                     var diffTime = time - pointerEvent.clickTime;
    112.                     if (diffTime < 0.3f)
    113.                         ++pointerEvent.clickCount;
    114.                     else
    115.                         pointerEvent.clickCount = 1;
    116.                    
    117.                     pointerEvent.clickTime = time;
    118.                 }
    119.                 else
    120.                 {
    121.                     pointerEvent.clickCount = 1;
    122.                 }
    123.                
    124.                 pointerEvent.pointerPress = newPressed;
    125.                 pointerEvent.rawPointerPress = currentOverGo;
    126.                
    127.                 pointerEvent.clickTime = time;
    128.                
    129.                 // Save the drag handler as well
    130.                 pointerEvent.pointerDrag = ExecuteEvents.GetEventHandler<IDragHandler>(currentOverGo);
    131.                
    132.                 if (pointerEvent.pointerDrag != null)
    133.                     ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.initializePotentialDrag);
    134.             }
    135.            
    136.             // PointerUp notification
    137.             if (released)
    138.             {
    139.                 // Debug.Log("Executing pressup on: " + pointer.pointerPress);
    140.                 ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);
    141.  
    142.                 // see if we mouse up on the same element that we clicked on...
    143.                 var pointerUpHandler = ExecuteEvents.GetEventHandler<IPointerClickHandler>(currentOverGo);
    144.                
    145.                 // PointerClick and Drop events
    146.                 if (pointerEvent.pointerPress == pointerUpHandler && pointerEvent.eligibleForClick)
    147.                 {
    148.                     ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerClickHandler);
    149.                 }
    150.                 else if (pointerEvent.pointerDrag != null)
    151.                 {
    152.                     ExecuteEvents.ExecuteHierarchy(currentOverGo, pointerEvent, ExecuteEvents.dropHandler);
    153.                 }
    154.                
    155.                 pointerEvent.eligibleForClick = false;
    156.                 pointerEvent.pointerPress = null;
    157.                 pointerEvent.rawPointerPress = null;
    158.                
    159.                 if (pointerEvent.pointerDrag != null && pointerEvent.dragging)
    160.                     ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler);
    161.                
    162.                 pointerEvent.dragging = false;
    163.                 pointerEvent.pointerDrag = null;
    164.                
    165.                 if (pointerEvent.pointerDrag != null)
    166.                     ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.endDragHandler);
    167.                
    168.                 pointerEvent.pointerDrag = null;
    169.                 ExecuteEvents.ExecuteHierarchy(pointerEvent.pointerEnter, pointerEvent, ExecuteEvents.pointerExitHandler);
    170.                 pointerEvent.pointerEnter = null;
    171.             }
    172.         }
    173.        
    174.         public override void DeactivateModule()
    175.         {
    176.             base.DeactivateModule();
    177.             ClearSelection();
    178.         }
    179.        
    180.         public override string ToString()
    181.         {
    182.             var sb = new StringBuilder();
    183.                 var pointerData = GetLastPointerEventData(kMouseLeftId);
    184.                 if (pointerData != null)
    185.                     sb.AppendLine(pointerData.ToString());
    186.  
    187.             return sb.ToString();
    188.         }
    189.     }
    190. }
    Only when I disable this module, then re-enable the mouse input on the standalone do I get the keyboard back.
    I have a feeling that my module is overwriting the standalone, and I dont know how to fix that. Any insights?

    Thanks very much
    -Ryan
     
  2. skalev

    skalev

    Joined:
    Feb 16, 2012
    Posts:
    264
    That might be the case, it is hard to tell without the code for your base class (PointerInputModule).

    It could be that the current rewired player doesn't have the keyboard assigned to it as an input device, hence it isn't passing the events down.

    I'm also noticing you are mixing calls to rewired along with input calls. It is probably better to only use rewired.
     
  3. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
    Code (CSharp):
    1.  
    2. using System.Collections.Generic;
    3. using System.Text;
    4. using UnityEngine.UI;
    5.  
    6. namespace UnityEngine.EventSystems
    7. {
    8.     public abstract class PointerInputModule : BaseInputModule
    9.     {
    10.         public const int kMouseLeftId = -1;
    11.         public const int kMouseRightId = -2;
    12.         public const int kMouseMiddleId = -3;
    13.  
    14.         public const int kFakeTouchesId = -4;
    15.  
    16.         protected Dictionary<int, PointerEventData> m_PointerData = new Dictionary<int, PointerEventData>();
    17.  
    18.         protected bool GetPointerData(int id, out PointerEventData data, bool create)
    19.         {
    20.             if (!m_PointerData.TryGetValue(id, out data) && create)
    21.             {
    22.                 data = new PointerEventData(eventSystem)
    23.                 {
    24.                     pointerId = id,
    25.                 };
    26.                 m_PointerData.Add(id, data);
    27.                 return true;
    28.             }
    29.             return false;
    30.         }
    31.  
    32.         protected void RemovePointerData(PointerEventData data)
    33.         {
    34.             m_PointerData.Remove(data.pointerId);
    35.         }
    36.  
    37.         protected PointerEventData GetTouchPointerEventData(Touch input, out bool pressed, out bool released)
    38.         {
    39.             PointerEventData pointerData;
    40.             var created = GetPointerData(input.fingerId, out pointerData, true);
    41.  
    42.             pointerData.Reset();
    43.  
    44.             pressed = created || (input.phase == TouchPhase.Began);
    45.             released = (input.phase == TouchPhase.Canceled) || (input.phase == TouchPhase.Ended);
    46.  
    47.             if (created)
    48.                 pointerData.position = input.position;
    49.  
    50.             if (pressed)
    51.                 pointerData.delta = Vector2.zero;
    52.             else
    53.                 pointerData.delta = input.position - pointerData.position;
    54.  
    55.             pointerData.position = input.position;
    56.  
    57.             pointerData.button = PointerEventData.InputButton.Left;
    58.  
    59.             eventSystem.RaycastAll(pointerData, m_RaycastResultCache);
    60.  
    61.             var raycast = FindFirstRaycast(m_RaycastResultCache);
    62.             pointerData.pointerCurrentRaycast = raycast;
    63.             m_RaycastResultCache.Clear();
    64.             return pointerData;
    65.         }
    66.  
    67.         private void CopyFromTo(PointerEventData @from, PointerEventData @to)
    68.         {
    69.             @to.position = @from.position;
    70.             @to.delta = @from.delta;
    71.             @to.scrollDelta = @from.scrollDelta;
    72.             @to.pointerCurrentRaycast = @from.pointerCurrentRaycast;
    73.             @to.pointerEnter = @from.pointerEnter;
    74.         }
    75.  
    76.         protected static PointerEventData.FramePressState StateForMouseButton(int buttonId)
    77.         {
    78.             var pressed = Input.GetMouseButtonDown(buttonId);
    79.             var released = Input.GetMouseButtonUp(buttonId);
    80.             if (pressed && released)
    81.                 return PointerEventData.FramePressState.PressedAndReleased;
    82.             if (pressed)
    83.                 return PointerEventData.FramePressState.Pressed;
    84.             if (released)
    85.                 return PointerEventData.FramePressState.Released;
    86.             return PointerEventData.FramePressState.NotChanged;
    87.         }
    88.  
    89.         protected class ButtonState
    90.         {
    91.             private PointerEventData.InputButton m_Button = PointerEventData.InputButton.Left;
    92.  
    93.             public MouseButtonEventData eventData
    94.             {
    95.                 get { return m_EventData; }
    96.                 set { m_EventData = value; }
    97.             }
    98.  
    99.             public PointerEventData.InputButton button
    100.             {
    101.                 get { return m_Button; }
    102.                 set { m_Button = value; }
    103.             }
    104.  
    105.             private MouseButtonEventData m_EventData;
    106.         }
    107.  
    108.         protected class MouseState
    109.         {
    110.             private List<ButtonState> m_TrackedButtons = new List<ButtonState>();
    111.  
    112.             public bool AnyPressesThisFrame()
    113.             {
    114.                 for (int i = 0; i < m_TrackedButtons.Count; i++)
    115.                 {
    116.                     if (m_TrackedButtons[i].eventData.PressedThisFrame())
    117.                         return true;
    118.                 }
    119.                 return false;
    120.             }
    121.  
    122.             public bool AnyReleasesThisFrame()
    123.             {
    124.                 for (int i = 0; i < m_TrackedButtons.Count; i++)
    125.                 {
    126.                     if (m_TrackedButtons[i].eventData.ReleasedThisFrame())
    127.                         return true;
    128.                 }
    129.                 return false;
    130.             }
    131.  
    132.             public ButtonState GetButtonState(PointerEventData.InputButton button)
    133.             {
    134.                 ButtonState tracked = null;
    135.                 for (int i = 0; i < m_TrackedButtons.Count; i++)
    136.                 {
    137.                     if (m_TrackedButtons[i].button == button)
    138.                     {
    139.                         tracked = m_TrackedButtons[i];
    140.                         break;
    141.                     }
    142.                 }
    143.  
    144.                 if (tracked == null)
    145.                 {
    146.                     tracked = new ButtonState { button = button, eventData = new MouseButtonEventData() };
    147.                     m_TrackedButtons.Add(tracked);
    148.                 }
    149.                 return tracked;
    150.             }
    151.  
    152.             public void SetButtonState(PointerEventData.InputButton button, PointerEventData.FramePressState stateForMouseButton, PointerEventData data)
    153.             {
    154.                 var toModify = GetButtonState(button);
    155.                 toModify.eventData.buttonState = stateForMouseButton;
    156.                 toModify.eventData.buttonData = data;
    157.             }
    158.         }
    159.  
    160.         public class MouseButtonEventData
    161.         {
    162.             public PointerEventData.FramePressState buttonState;
    163.             public PointerEventData buttonData;
    164.  
    165.             public bool PressedThisFrame()
    166.             {
    167.                 return buttonState == PointerEventData.FramePressState.Pressed || buttonState == PointerEventData.FramePressState.PressedAndReleased;
    168.             }
    169.  
    170.             public bool ReleasedThisFrame()
    171.             {
    172.                 return buttonState == PointerEventData.FramePressState.Released || buttonState == PointerEventData.FramePressState.PressedAndReleased;
    173.             }
    174.         }
    175.  
    176.         private readonly MouseState m_MouseState = new MouseState();
    177.         protected virtual MouseState GetMousePointerEventData()
    178.         {
    179.             // Populate the left button...
    180.             PointerEventData leftData;
    181.             var created = GetPointerData(kMouseLeftId, out leftData, true);
    182.  
    183.             leftData.Reset();
    184.  
    185.             if (created)
    186.                 leftData.position = Input.mousePosition;
    187.  
    188.             Vector2 pos = Input.mousePosition;
    189.             leftData.delta = pos - leftData.position;
    190.             leftData.position = pos;
    191.             leftData.scrollDelta = Input.mouseScrollDelta;
    192.             leftData.button = PointerEventData.InputButton.Left;
    193.             eventSystem.RaycastAll(leftData, m_RaycastResultCache);
    194.             var raycast = FindFirstRaycast(m_RaycastResultCache);
    195.             leftData.pointerCurrentRaycast = raycast;
    196.             m_RaycastResultCache.Clear();
    197.  
    198.             // copy the apropriate data into right and middle slots
    199.             PointerEventData rightData;
    200.             GetPointerData(kMouseRightId, out rightData, true);
    201.             CopyFromTo(leftData, rightData);
    202.             rightData.button = PointerEventData.InputButton.Right;
    203.  
    204.             PointerEventData middleData;
    205.             GetPointerData(kMouseMiddleId, out middleData, true);
    206.             CopyFromTo(leftData, middleData);
    207.             middleData.button = PointerEventData.InputButton.Middle;
    208.  
    209.             m_MouseState.SetButtonState(PointerEventData.InputButton.Left, StateForMouseButton(0), leftData);
    210.             m_MouseState.SetButtonState(PointerEventData.InputButton.Right, StateForMouseButton(1), rightData);
    211.             m_MouseState.SetButtonState(PointerEventData.InputButton.Middle, StateForMouseButton(2), middleData);
    212.  
    213.             return m_MouseState;
    214.         }
    215.  
    216.         protected PointerEventData GetLastPointerEventData(int id)
    217.         {
    218.             PointerEventData data;
    219.             GetPointerData(id, out data, false);
    220.             return data;
    221.         }
    222.  
    223.         private static bool ShouldStartDrag(Vector2 pressPos, Vector2 currentPos, float threshold, bool useDragThreshold)
    224.         {
    225.             if (!useDragThreshold)
    226.                 return true;
    227.  
    228.             return (pressPos - currentPos).sqrMagnitude >= threshold * threshold;
    229.         }
    230.  
    231.         protected virtual void ProcessMove(PointerEventData pointerEvent)
    232.         {
    233.             var targetGO = pointerEvent.pointerCurrentRaycast.gameObject;
    234.             HandlePointerExitAndEnter(pointerEvent, targetGO);
    235.         }
    236.  
    237.         protected virtual void ProcessDrag(PointerEventData pointerEvent)
    238.         {
    239.             bool moving = pointerEvent.IsPointerMoving();
    240.  
    241.             if (moving && pointerEvent.pointerDrag != null
    242.                 && !pointerEvent.dragging
    243.                 && ShouldStartDrag(pointerEvent.pressPosition, pointerEvent.position, eventSystem.pixelDragThreshold, pointerEvent.useDragThreshold))
    244.             {
    245.                 ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.beginDragHandler);
    246.                 pointerEvent.dragging = true;
    247.             }
    248.  
    249.             // Drag notification
    250.             if (pointerEvent.dragging && moving && pointerEvent.pointerDrag != null)
    251.             {
    252.                 // Before doing drag we should cancel any pointer down state
    253.                 // And clear selection!
    254.                 if (pointerEvent.pointerPress != pointerEvent.pointerDrag)
    255.                 {
    256.                     ExecuteEvents.Execute(pointerEvent.pointerPress, pointerEvent, ExecuteEvents.pointerUpHandler);
    257.  
    258.                     pointerEvent.eligibleForClick = false;
    259.                     pointerEvent.pointerPress = null;
    260.                     pointerEvent.rawPointerPress = null;
    261.                 }
    262.                 ExecuteEvents.Execute(pointerEvent.pointerDrag, pointerEvent, ExecuteEvents.dragHandler);
    263.             }
    264.         }
    265.  
    266.         public override bool IsPointerOverGameObject(int pointerId)
    267.         {
    268.             var lastPointer = GetLastPointerEventData(pointerId);
    269.             if (lastPointer != null)
    270.                 return lastPointer.pointerEnter != null;
    271.             return false;
    272.         }
    273.  
    274.         protected void ClearSelection()
    275.         {
    276.             var baseEventData = GetBaseEventData();
    277.  
    278.             foreach (var pointer in m_PointerData.Values)
    279.             {
    280.                 // clear all selection
    281.                 HandlePointerExitAndEnter(pointer, null);
    282.             }
    283.  
    284.             m_PointerData.Clear();
    285.             eventSystem.SetSelectedGameObject(null, baseEventData);
    286.         }
    287.  
    288.         public override string ToString()
    289.         {
    290.             var sb = new StringBuilder("<b>Pointer Input Module of type: </b>" + GetType());
    291.             sb.AppendLine();
    292.             foreach (var pointer in m_PointerData)
    293.             {
    294.                 if (pointer.Value == null)
    295.                     continue;
    296.                 sb.AppendLine("<B>Pointer:</b> " + pointer.Key);
    297.                 sb.AppendLine(pointer.Value.ToString());
    298.             }
    299.             return sb.ToString();
    300.         }
    301.  
    302.         protected void DeselectIfSelectionChanged(GameObject currentOverGo, BaseEventData pointerEvent)
    303.         {
    304.             // Selection tracking
    305.             var selectHandlerGO = ExecuteEvents.GetEventHandler<ISelectHandler>(currentOverGo);
    306.             // if we have clicked something new, deselect the old thing
    307.             // leave 'selection handling' up to the press event though.
    308.             if (selectHandlerGO != eventSystem.currentSelectedGameObject)
    309.                 eventSystem.SetSelectedGameObject(null, pointerEvent);
    310.         }
    311.     }
    312. }
     
    Last edited: Apr 19, 2016
  4. skalev

    skalev

    Joined:
    Feb 16, 2012
    Posts:
    264
    First, you probably shouldn't post the code from rewired onto the forums.

    What I asked for is the base class, which according to your implementation is PointerInputModule.

    It looks like, judging by the code from Rewired, that you are not doing anything to process the keyboard events ( compare the 2 Process() functions), which will be the problem. If you aren't processing the input, nothing will happen.
     
  5. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
    Ok, Ive removed the Rewired code.

    Well I suppose this is the issue: I dont want to handle the keyboard events in my module. Can't the Rewired Module still pass that information to the event system, and my module only handle clicks and movements?

    Regarding the Process functions, those are both overrides and I don't necessarily want to override the Rewired Process. If I try to call base.Process(), I get an error. Should I bite the bullet and just add my own keyboard events to my module, or is there a more clever way to let Rewired do its thing, separate from mine?
     
  6. skalev

    skalev

    Joined:
    Feb 16, 2012
    Posts:
    264
    I think you are confused a bit. You are not inheriting from the Rewired Input module, you are inheriting from Unity's PointerInputModule, which doesn't handle keyboard at all.

    This is why the call to base.Process() gives you an error, since that is an abstract method defined in BaseInputModule.

    In fact what you are doing is writing your own module, so you would have to add your own keyboard controls.

    If you want to use the rewired module, you need to replace your base class, inherit from the rewired one, possibly change some of its functions to be protected / virtual, and just override those with the new implementation you need.
     
  7. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
    Ok, I think I understand now. Part of the criteria is to not modify the Rewired Standalone, as it gets updated regularly by Rewired. I will just have to write my own keyboard input or my own Standalone I suppose. I thought there was a way around this, so that's why I asked. Thanks for the help skalev :).
     
  8. skalev

    skalev

    Joined:
    Feb 16, 2012
    Posts:
    264
    You have already written your own standalone, you just have to add keyboard support.

    You won't actually be technically changing it. Or at least just not the implementation. All you'll really need is to perhaps override some functions that are not marked virtual, hence you'll need to change the function signatures. If you are using any source control for your code, you'll be able to pretty easily merge those changes with any changes coming from Augie's side.
     
  9. RedRiverStudio

    RedRiverStudio

    Joined:
    Sep 8, 2014
    Posts:
    136
    I just ran some tests where I disabled the Rewired Standalone completely. Nothing changed at all, I had full control of everything, which means I fundamentally didn't understand the purpose of the Standalone in the first place. I had always thought the Rewired Standalone was required for any Rewired inputs, but each object calling the Rewired.Player controls its self. You are right, I have effectively written my own, thinking it was a piggyback, when really it was just fighting with the Rewired one. I am adding the keyboard support now.
     
  10. skalev

    skalev

    Joined:
    Feb 16, 2012
    Posts:
    264
    Yes. The rewired standalone input is used to allow rewired to control Unity UI events. If you write your own module and replace use rewired as the input manager, you are re-creating it.

    I'd like to point out again, that in your code, you call both Input.GetMouseButton, and player.GetButton()
    What this does is effectively circumvent Rewired's action/controller map system, which defeats the purpose of using it in the first place.