Search Unity

[Released] cInput 2 - Unitys custom inputmanager got improved !

Discussion in 'Assets and Asset Store' started by Roidz99, Apr 4, 2012.

  1. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    Do you use something along the lines of event.current.keycode.tostring() to display which key was bound?
     
  2. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Good news, everyone!

    cInput 2.5.5 was finally accepted on the asset store (as 2.5.5.1 since it wouldn't let me resubmit with the number 2.5.5 after it was initially rejected). The update appears to be live right now. For anyone experiencing issues, please update to this version and let us know if your problems persist.

    Yes, we do use something along the lines of KeyCode.ToString() to display which key is bound.
     
  3. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    just wondering if anyone has used cinput with an x-box controller ?? in particular the L/R Triggers. (not bumpers)

    I would like to swap to Cinput and have x-box triggers apply min. 0 - 100 max power to a laser canon as the player gradually applies more trigger.

    Is this possible if so how would I go about setting this up ??

    It would be neat to see an example of this with the ability for a player to adjust a slider to alter input trigger amount within a controller setup screen.

    Regarding the DEMO GAME Scene: ( the top down space ship retro shooter)
    I've tried running the Demo scene, hitting ESC takes me into the menu system... but only buttons are recognised. For example, If I move a joy stick to the left, it's not recognised.
    It seems only buttons are recognised.
    My game is able to use x-box controller but for some reason if I hit a button e.g.. GetButton("ShowHUD") it fires off many times... so I tried GetButtonDown("ShowHUD") it does not recognise it :(
    This is why I'd like to swap over to Cinput... I'm hoping Cinput will recognise x-box GetButtonDown()
    + recognise the Triggers Left trigger = "5th Axis" Right Trigger = "6th Axis"

    Has Cinput been tested with an x-box controller ?
     
    Last edited: Aug 15, 2013
  4. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    So it will display garbage for anyone not using an US keyboard layout
     
  5. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I haven't heard any reports about cInput displaying garbage for non-US keyboard layouts. I have a US keyboard so I can't test it, but Roidz has a non-US keyboard layout and as far as I know he hasn't noticed any problems. If you've got a non-US keyboard layout, you can try the web demo and see for yourself if it displays garbage or not.

    It sounds to me like Unity isn't recognizing your Xbox controller properly. Again, using the Web Demo I linked above, I am able to bind the analog sticks and triggers for my gamepad (a PS3 gamepad I tricked my computer into thinking is an Xbox controller with MotioninJoy), though the triggers are recognized as JoystickAxis3- and JoystickAxis3+ and not the 5th and 6th axes. Or you can also access the triggers individually on axes 9 and 10.

    cInput has indeed been used with an Xbox controller. I've not heard any reports about incompatibilities. But if your computer/Unity doesn't recognize your Xbox controller properly, neither will cInput.

    Assuming your PC does recognize the controller properly, the way to do what you're asking would be to make an axis for each trigger and multiply the value by 100, since the returned range will be a float between 0 and 1. (You might need to multiply one of them by -100 or just use the absolute value of the axis to account for one of the triggers being considered a negative axis).
     
    Last edited: Aug 15, 2013
  6. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102

    What I pressed:

    +
    ß
    #
    ^
    windows key
    left alt
    right alt
     
  7. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I see. . . Interesting. So how do folks with non-US keyboard layouts get the proper string for the key they're pressing?
     
  8. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    I have no idea.

    Didn't find a solution for this with with extensive googling
    Oh by the way, the default unity input manager thing (before you start a game) also has this problem.
     
  9. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    259
    cInput uses a Unity input manager filled with bound keys to basically create a virtual keyboard. If you were to rebind those in the launcher, you may be able to fix some of those, but not all of them. You would basically be rebinding your physical keyboard to the virtual one before then binding those virtual keys to game functions. This is similar to the way one would emulate a 360 gamepad with a non-360 pad. Just consider cInput a US keyboard emulator. I can't test this, because I've yet to pick up cInput; that's just what I gather from the documentation.
     
  10. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    So the only way to display the correct strings is to create some 256 string array for every keyboard available and let the user select which to use? sounds crap :v
     
  11. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    cInput basically provides a wrapper around Unity's Input Manager, so any problems with Unity's Input Manager will exist in cInput. This includes KeyCode.ToString() being incorrect in some cases, unfortunately.
     
  12. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    259
    Nah. Users can just rebind the specific keys they use for the game themselves if they want properly-displayed labels. It's no different than rebinding a non-360 pad for a game that supports both 360 and generic controllers; if you use the generic controller by itself, you'll get junk like "joystick button 0" instead of (A), which isn't any worse than getting # in place of whatever key you actually pressed, but you can always emulate a 360 pad for better labels, even if your gamepad has more buttons and axes than what you need to emulate a standard 360 pad.
     
    Last edited: Aug 15, 2013
  13. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    Thanks so much for the reply....
    I don't think I can use MotioninJoy as I'm running Unity on a MacBook Pro. TattieBogle.net is my current controller driver. I was thinking of changing to Xinput as I believe it has a Mac driver.

    I can get input from most of my x-box controller buttons I can control my character with the x-box thumb sticks.

    My problem lies with GetButtonDown() for some reason only GetButton() works.. it fires off many times each press.
     
  14. Zeblote

    Zeblote

    Joined:
    Feb 8, 2013
    Posts:
    1,102
    When you press a key in a controls manager, you expect it to show up right. Every game does this.
    Same for when you enter something in a text field. You expect a Z, you get a Z. What would you say if you enter a username, but when you press Z you get a # and the game tells you if you want proper letters you have to remap some keys outside of the game? Wouldn't you yell at the developers to fix their S***?
     
  15. OhiraKyou

    OhiraKyou

    Joined:
    Mar 27, 2012
    Posts:
    259
    Nope.
     
  16. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I'd try Xinput for your gamepad. I believe that is what MotioninJoy uses.

    As for why GetButton fires multiple times, it's because that's the way it works. Every frame the button is being pushed, it will fire GetButton. But if you only want to fire the code once for each time the button is pressed, that's what GetButtonDown is used for. It makes me wonder if it actually is working the way it is supposed to be working, but maybe your code isn't designed to work with it properly. I can't imagine why GetButton would work but GetButtonDown wouldn't.
     
  17. ShawnMcCoo1

    ShawnMcCoo1

    Joined:
    Dec 26, 2011
    Posts:
    39
    Hey everyone, I wonder if I may not have found a bug (probably not).

    But, here's my cInput config:
    Code (csharp):
    1.  
    2.         cInput.Init();
    3.         cGUI.cSkin = GuiSkin;
    4.         cGUI.bgColor = MenuColor;
    5.         cInput.allowDuplicates = false;
    6.         cGUI.windowMaxSize = new Vector2(1024, 600);
    7.  
    8.         cInput.SetKey("Menu", Keys.Escape);
    9.  
    10.         cInput.SetKey("Move Left", Keys.A);
    11.         cInput.SetKey("Move Right", Keys.E, Keys.D);
    12.  
    13.         cInput.SetAxis("Horizontal", "Move Left", "Move Right");
    14.  
    15.         // Punches
    16.         cInput.SetKey("Punch Up", Keys.UpArrow);
    17.         cInput.SetKey("Punch Down", Keys.DownArrow);
    18.         cInput.SetKey("Punch Left", Keys.LeftArrow);
    19.         cInput.SetKey("Punch Right", Keys.RightArrow);
    When I hold move left / right my Horizontal axis climbs up to near 1f or -1f. When I hold the RIGHT ARROW my Horizontal axis seems to be multiplied by .06 or something like that. This is very strange to me.

    Any ideas?
     
  18. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    hmm this is indeed very strange. I will look into this and try to reproduce this behaviour.
    What version of cInput are you using ?
     
  19. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    I tried reproducing this bug but i can't. Are you sure something else is not messing up your readings ?

    If you are sure it's not please provide us with a small test scene/project so we can take a better look at it.
     
  20. ShawnMcCoo1

    ShawnMcCoo1

    Joined:
    Dec 26, 2011
    Posts:
    39
    I'm digging into this. If I can't resolve it shortly, I'm going to make a test project that contains only the base pieces necessary.

    Edit: I changed the controls from "Move Left" and "Move Right" to "P1 Move Left" and "P1 Move Right" and the problem is gone... strange.
     
    Last edited: Aug 26, 2013
  21. Laztor

    Laztor

    Joined:
    Nov 10, 2012
    Posts:
    3
    We just ended up doing button mappings instead of using axes, and then slerping to smooth it out. Package is great otherwise.
     
  22. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I do believe that bug was fixed in the latest release of cInput. Please let us know if it's still causing you problems.

    Thanks!
     
  23. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Hi folks,

    An update to cInput has been submitted to the Asset Store and the cInput website. If you bought cInput from the Asset Store then the update should be available within about 3 (business) days, but in the past has been available as soon as 24 (business) hours. If you bought cInput from our website, then the update is available as of now.

    cInput changes:

    v2.5.6
    • Converted cInput scripts to UTF-8 which should prevent MonoDevelop errors. (Thanks Matumit)
    • Renamed Demo Class files to prevent Class/Namspace conflicts. (Thanks Michael)
    • Cleaned up a bunch of Debug Logs that accidentally got left in there somehow.
     
  24. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I guess the Asset Store folks are busy lately, as it's taking longer than it has in the past to accept submission updates. I just received notification that cInput 2.5.6 is now live on the Asset Store (or will be within the hour).

    Enjoy the update. (c:
     
  25. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    298
    Hi Deozaan,

    I've had a read through the docs and can't seem to find a solution, understandably because it's a very specific problem, hehe.

    I'm wondering if there's a way to detect whether any of the primary input settings have been detected? So the first definition that I set. Basically I've set up an Xbox controller, and want to change all the instructions to Xbox buttons should they press a button on their controller. Obviously I could do this by detecting each individual button, I just wondered if there was a more generic solution?

    Additionally, I've configured an external save, and am wondering if there's a way to stop cInput writing to the player prefs at all?
     
  26. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Hi gumboots,

    There isn't really a built-in way for cInput to do this, but here's something I came up with that might work:

    Code (csharp):
    1. bool usingGamepad = false
    2. int maxButtons = 10;
    3.  
    4. if (!usingGamepad) {
    5.     for (int i = 0; i < maxButtons; i++) {
    6.         if (Input.GetButton("joystick button " + i)) {
    7.             // a gamepad button has been pressed
    8.             usingGamepad = true;
    9.             // do some code here that swaps controls to Xbox gamepad
    10.             break;
    11.         }
    12.     }
    13. }
    As for cInput not writing to PlayerPrefs at all... That's currently not an option. It is on the ToDo list, but with a fairly low priority. I think it will likely end up in a future edition of cInput, but I can't really give an ETA on when.
     
  27. gumboots

    gumboots

    Joined:
    May 24, 2011
    Posts:
    298
    Hi there,

    Thanks for that. I've just loaded cInput into a new project, and noticed there's quite a different way of doing it now. I followed the instructions (Using the menu) and then used my previous method to get cInput going, and unless I'm mad there seems to be something wrong. When I copy pasted my definitions:

    Code (csharp):
    1.  
    2. cInput.SetKey("Look Up", Keys.Joy1Axis5Negative);
    3. cInput.SetKey("Look Down", Keys.Joy1Axis5Positive);
    4. cInput.SetKey("Look Left", Keys.Joy1Axis4Negative);
    5. cInput.SetKey("Look Right", Keys.Joy1Axis4Positive);
    6. cInput.SetAxis("Look Horizontal", "Look Left", "Look Right");
    7. cInput.SetAxis("Look Vertical", "Look Down", "Look Up");
    8.  
    I get the error "Failed to get any cases for Joy1 Axis 4+. Using main raw value of 0. This should never happen, in theory." for each of the axis. However even on my Move axis, (Which is the same as above, but with Keys.W etc. as secondary) if I remove the joystick declarations I get told there's no such axis as "Move Horizontal", even though the code is directly copied from a previously working project.

    Any ideas? Pulling my hair out here. Thanks in advance.

    Also, deleting the GUI files creates a storm of errors when I try and find the areas to comment out. It also seems strange to have to go into the plugin to edit the source to disable features?
     
  28. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    I have bindings for mouse wheel up and mouse wheel down (controls zoom in and zoom out for my game). I've just updated to latest release and now my console is filled with the follow.

    Code (csharp):
    1.  
    2. Failed to get any cases for Mouse Wheel Up. Using main raw value of 0. This should never happen, in theory.
    3. UnityEngine.Debug:LogError(Object)
    4. cInput:_GetCalibratedAxisInput(String) (at Assets/Plugins/cMonkeys/cInput.cs:525)
    5. cInput:CheckInputs() (at Assets/Plugins/cMonkeys/cInput.cs:739)
    6. cInput:Update() (at Assets/Plugins/cMonkeys/cInput.cs:183)
    7.  
    Code (csharp):
    1.  
    2. Failed to get any cases for Mouse Wheel Up. Using main raw value of 1. This should never happen, in theory.
    3. UnityEngine.Debug:LogError(Object)
    4. cInput:_GetCalibratedAxisInput(String) (at Assets/Plugins/cMonkeys/cInput.cs:525)
    5. cInput:CheckInputs() (at Assets/Plugins/cMonkeys/cInput.cs:739)
    6. cInput:Update() (at Assets/Plugins/cMonkeys/cInput.cs:183)
    7.  
    Code (csharp):
    1.  
    2. Failed to get any cases for Mouse Wheel Up. Using main raw value of -1. This should never happen, in theory.
    3. UnityEngine.Debug:LogError(Object)
    4. cInput:_GetCalibratedAxisInput(String) (at Assets/Plugins/cMonkeys/cInput.cs:525)
    5. cInput:CheckInputs() (at Assets/Plugins/cMonkeys/cInput.cs:739)
    6. cInput:Update() (at Assets/Plugins/cMonkeys/cInput.cs:183)
    7.  
    Any idea what the problem is? It seams like there's some sort of missing IF check there as my key binds are working fine still. I've went ahead and just commented out the Debug.Log usage.
     
  29. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    You're right! Some unfinished work was being done on the axis calibration code which somehow snuck its way into the release! I've got a fix ready for the next release, but that may take a few days to get through the Asset Store approval process, so in the meantime, here's how you can fix it yourself:

    In cInput.cs at about line 510, change the following line:

    Code (csharp):
    1. if (description == joystring) {
    to:
    Code (csharp):
    1. if (description == joystring + "+" || description == joystring + "-") {
    And that should fix your error.

    I'm not sure I understand the problem here. Which files are you deleting? What areas are you commenting out? What features are you trying to disable? I can delete the entire cMonkeys/cGUI folder and get no LogErrors.

    Are you talking about the first line of cInput that says to comment out that line to disable using cGUI? That's in there to maintain backwards compatibility with previous versions of cInput, since the GUI used to be built right into cInput.cs instead of as separate scripts. Commenting out or removing the first line of cInput will allow you to safely remove the cGUI related scripts without getting errors.

    I hope this helps.

    EDIT:

    We posted at about the same time. The change above should fix your issue as well. Sorry!
     
    Last edited: Sep 15, 2013
  30. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Hi folks,

    An update to cInput has been accepted on the Asset Store and is also available on the cInput website. If you bought cInput from the Asset Store then the update should be live within about 1 hour. If you bought cInput from our website, then the update is available immediately.

    cInput changes:

    v2.5.7
    • Fixed a bug in axis calibration code. (Thanks gumboots and Krileon)
     
  31. RyuMaster

    RyuMaster

    Joined:
    Sep 13, 2010
    Posts:
    468
    Hi! If I want my character to move automatically for some time, is that possible to simulate with cInput? Like, does it have something liek SetAxis("Horizontal") which will emulate horizontal axis being pressed?
     
  32. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    hey ryu,

    This sounds like it's something you should do in your own code rather then using cInput for this.
     
  33. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I think what Roidz means is that it's up to you to write how your code responds to input. So there's nothing keeping you from using a boolean called something like movingLeft and then using cInput to set it to true or setting it to true manually when you want the automatic movement. For example:

    Code (csharp):
    1.     bool movingLeft = false;
    2.  
    3.     void HandleMovement() {
    4.         if (cInput.GetAxis("Horizontal") < 0) {
    5.             movingLeft = true;
    6.         }
    7.  
    8.         if (movingLeft) {
    9.             transform.Translate(Vector3.left);
    10.         }
    11.     }
    In the above code, there is nothing keeping you from setting the movingLeft variable to true in some other part of your code. The object will be moved to the left if the bool is true, regardless of whether or not cInput detects any input on the Horizontal axis.
     
  34. Deleted User

    Deleted User

    Guest

    Hello, just a quick question. Is byteCommerce down or something? I'm trying to download the new version but all links to byteCommerce give an error.
     
  35. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Yes. It's down and not coming back as far as we're aware. We've reestablished our store on FastSpring and sent an email to all ByteCommerce customers with a coupon code to redeem cInput for free. Check the email account you used to purchase cInput, and your spam box. It was sent in August. If you don't have it or can't find it, please send us an email or PM with the email address you used to purchase cInput and we'll resend it to you.
     
    Last edited: Sep 26, 2013
  36. Deleted User

    Deleted User

    Guest

    Sent you a PM.
     
  37. Harabeck

    Harabeck

    Joined:
    Mar 27, 2012
    Posts:
    10
    Every time call ChangeKey I get errors like this spamming my log until the new key is detected:

    Code (csharp):
    1. Failed to get any cases for Joy1 Axis 1. Using main raw value of 0. This should never happen, in theory.
    2. UnityEngine.Debug:LogError(Object)
    3. cInput:_GetCalibratedAxisInput(String) (at Assets/Plugins/cInput/cInput.cs:536)
    4. cInput:_InputScans() (at Assets/Plugins/cInput/cInput.cs:1938)
    5. cInput:Update() (at Assets/Plugins/cInput/cInput.cs:187)
    It cycles to Joy1 Axis2... on to Joy2 Axis 1 etc.

    I haven't seen any gameplay problems from it, but it's annoying to have my log filled up with this stuff. Any idea on how to fix this?
     
  38. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Are you using the latest version of cInput? I think this should be fixed as of v2.5.7.
     
  39. Harabeck

    Harabeck

    Joined:
    Mar 27, 2012
    Posts:
    10
    Yes, I am using 2.5.7. I'll try deleting cInput and re-importing.

    Edit: no change, still seeing the messages. Confirm seeing the 2.5.7 version number at the top of cInput.cs.
     
    Last edited: Sep 27, 2013
  40. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    OK, I see it, too. I'll look into a fix.

    For now, just comment out line 524 and that should stop the message from being spammed to your console.
     
  41. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Hi folks,

    An update to cInput has been submitted to the Asset Store. If you bought cInput from the Asset Store then the update should be live within a few (business) days. If you bought cInput from our website, then the update is available immediately.

    cInput changes:

    v2.5.8
    • Fixed an error in the console log. (Thanks Matt and Harabeck)
     
  42. Goblox

    Goblox

    Joined:
    Nov 3, 2012
    Posts:
    178
    I haven't spent much time looking into it but with a Logitech G25 each time I attempt to set an input with GUI, Joy2 Axis 3+ is detected instantly. Any thoughts?
     
  43. Goblox

    Goblox

    Joined:
    Nov 3, 2012
    Posts:
    178
    Also,
    I find that after the first time I call SetAxis() using the (Name, Input) overload, no more SetAxis calls are registered. ("Couldn't find an axis match for...")

    Code (csharp):
    1.    
    2. cInput.SetAxis("Move Longitudinal", "Left", "Right");
    3. cInput.SetAxis("Move Lateral", "Back", "Forward"); 
    4. cInput.SetAxis("Steer", "Left", "Right");
    5. cInput.SetAxis("Throttle", "Throttle");
    6. cInput.SetAxis("Brake", "Brake");
    7. cInput.SetAxis("Clutch", "Clutch");
    8.  
    In this example, The Throttle axis is functional but Brake and Clutch are not found. Placing the Brake line above the Throttle line with no other changes means that Brake now works and Throttle and Clutch are not found. Placing the Throttle line above all the others means that only the Throttle axis is accessible.

    Also is there a flag I can set to disable keyboard, mouse, or joystick input temporarily? I handle this with a relatively convoluted state machine currently but I'd probably be interested in relying on cInput to make things more DRY.

    For example: User is in a menu or typing in a textfield and gameplay objects should ignore mouse or keyboard input, but the joystick can stay functional. ...(Or maybe should also be disabled in the case of a console controller). It would probably be worth configuring this on a per key/axis basis.
     
  44. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Sounds like your controller is not properly callibrated and is always 'on' when in rest. Try using the callibrate from windows or from the logitec controller itself. If this is not the case and you only have these problems with cInput try setting a differend deadzone or use the cInput callibrate function.

    I just noticed that the Logitech G25 is a steering wheel controller. Is Joy2 Axis 3+ perhaps a pedal or something ?
    I suggest running the cInput callibrate function
     
  45. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    That seems odd indeed. Can you paste us the exact errors you are getting please ?

    You can choose for cInput to allow/disallow certain input devices but you can't change this on the fly, sorry
     
  46. Goblox

    Goblox

    Joined:
    Nov 3, 2012
    Posts:
    178
    I'm at work at the moment so I can't give you an example of output but I'm nearly certain that it is not unusual for higher end racing wheels to report pedal axis from 0 to 1.

    I'm afraid with the G25 and G27, the pedals are all reverse with 1 Minimum and 0 being Max. Has anyone else used the G25 or G27 with cInput?
     
  47. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Goblox, normally the callibrate function should fix this. Try out the webdemo on our website when your home please.
     
  48. Goblox

    Goblox

    Joined:
    Nov 3, 2012
    Posts:
    178
    Excellent, thanks.

    Actually there is no exception thrown (or any indication that anything has gone wrong) until the "Couldn't find an axis match for AXISNAME" exception when code attempts to access a key or axis that was set after the problem Overload.

    Let me know if you can reproduce it on your end. I attempted to use a blank project but ran out of time last night.
     
    Last edited: Sep 30, 2013
  49. Goblox

    Goblox

    Joined:
    Nov 3, 2012
    Posts:
    178
    You should be able to reproduce this with a blank project even.
    Add the following line at LINE 50 of cInputDemoSetup:
    Code (csharp):
    1. cInput.SetAxis("TestAxis", "Shoot");
    Subsequent SetAxis calls do not seem to work.

    If you change it to:
    Code (csharp):
    1. cInput.SetAxis("TestAxis", "Shoot", "Pause");
    And utilize the other Overload everything is fine.
     
  50. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    You're right. Using the SetAxis(name, input) overload function causes an IndexOutOfRange exception, which is why subsequent calls to SetAxis don't do anything.

    I've found the problem and the fix will be available in cInput 2.5.9 or higher. (2.5.8 is currently being reviewed for acceptance by the Asset Store administration, so this change won't make it in that one.)

    In the meantime, you can fix this yourself manually by changing a few lines that make reference to posInput in cInput.cs around line 422, wrapping them in an if statement like so:

    Code (csharp):
    1.  
    2. if (posInput >= 0) {
    3.     _individualAxisSens[posInput] = axisSensitivity;
    4.     _individualAxisGrav[posInput] = axisGravity;
    5.     _individualAxisDead[posInput] = axisDeadzone;
    6. }
    7.  
    Thanks!