Search Unity

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

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

  1. xadhoom

    xadhoom

    Joined:
    Sep 2, 2010
    Posts:
    91
    Hi Deozaan,

    Thank you for this nice plugin. Looking at your code I have a small recommendation for you which is related to the initialization of cInput, namely the creation of the gameobject which happens in the Init() method. For your cInput class (static singleton-like class) the concept of static initialization would perfectly apply. Doing this you could get you rid of all these _createObject() calls just to ensure that everything is initialized.

    Since I have to integrate cInput into our framework I would be happy to support you with this...

    xad

    PS: I would also be happy if you could move the menu GUI code into a separate class to keep things clean. Probably you already did this for the upcoming version.
     
    Last edited: Apr 12, 2013
  2. Copywright

    Copywright

    Joined:
    Apr 17, 2012
    Posts:
    21
    Hey,

    I've at pretty simple question. I want to make an array of the keys I set in cInput, much like I could use KeyCode[] to make an array or keys. Is it possible to either have cInput.SetKeys[] or be able to pass in the keys set in cInput for the KeyCode array?

     
  3. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I think that cInput.GetText() should help you accomplish what you want to do.

    I'd be happy to see what you have to suggest regarding static initialization. And you're right, we do have some big GUI changes about to be released in the upcoming version.
     
  4. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Just letting you guys know that cInput 2.5.0 is out ! I
     
  5. Deozaan

    Deozaan

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

    As Roidz said, 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 24 (business) hours. If you bought it from the website then the update is available right now.

    NOTE: This is a fairly significant change to cInput internally. And some of the old GUI functions/methods have been deprecated to make way for the new, separate GUI script. The good news is that if you're using any of the old GUI code, it should warn you to update your scripts to use the new GUI stuff.

    One of the big new features this version has is the ability to use modifier keys.

    We also re-organized the directory structure, so the proper way to upgrade from cInput versions before 2.5.0 is to just delete all the old cInput folders and files and import the new package file.

    cInput changes:

    v 2.5.0
    • Added the ability to set up and use modifier keys with AddModifier() and SetKey(). (Thanks Steve Tack and others)
    • Added the ability to set gravity with SetAxisGravity() rather than having all axes use the same gravity. (Thanks Can Baycay)
    • You can now also set the gravity for an axis when you create it with SetAxis(). (Thanks Can Baycay)
    • Rewrote GUI code and separated it from cInput into its own script (see cGUI documentation).
    • Separated Keys class from cInput into separate script.
    • Added new GUISkins.
     
  6. Kementh

    Kementh

    Joined:
    Dec 13, 2012
    Posts:
    3
    I just updated to 2.5.0 and are still poking about to check on what changes have been made but i have uncovered one bug so far.

    I had hacked in my own support for individual axis gravity, but was pleased to see that it had been implemented in the new version.
    Sadly it's not working for me.

    Whenever I try and set a per Axis gravity, it ends up effecting all axis, EG.

    Code (csharp):
    1. cInput.SetAxis("Yaw","YawLeft","YawRight");
    2. cInput.SetAxisGravity("Yaw",3.0f);
    3. cInput.SetAxis("Pitch","PitchDown","PitchUp");
    4. cInput.AxisInverted("Pitch",true);
    5. cInput.SetAxis("Roll","RollLeft","RollRight");
    6. cInput.SetAxis("Throttle","ThrottleDown","ThrottleUp",1.0f);
    7. cInput.SetAxisGravity("Throttle",0f);

    All Axis respond with a Gravity of 0.0 rather then just the throttle, this happens no matter what i set the gravity to.
     
  7. Deozaan

    Deozaan

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

    I was about to head to bed when I saw your post here. Maybe I'm just tired, but I can't seem to duplicate this error.

    In the included demo project, I've made the following changes (starting about line 50) to Setup.cs:

    Code (csharp):
    1.  
    2. // we define an axis like this:
    3. cInput.SetAxis("Horizontal", "Left", "Right", 0.3f, 3f); // we set up the 'Horizontal' axis with 'Left' and 'Right'as inputs
    4. cInput.SetAxis("Vertical", "Up", "Down"); // we set up 'Vertical' axis with 'Up' and 'Down' as inputs.
    5. cInput.SetAxisGravity("Vertical", 0f);
    If setting gravity for one axis sets it for all axes, then Horizontal gravity should be 0f, but when I test the horizontal axis, it has the gravity of 3f.

    This leads me to believe that the problem you're experiencing is either due to not upgrading to 2.5.0 properly, or some old values being loaded in from PlayerPrefs.

    Can you try clearing cInput's settings (with cInput.Clear()) to see if maybe it's just old values that were saved that are messing it up? Or maybe try recreating the problem in a new project to verify that it's a bug with cInput 2.5.0 and not some problem with old values not updating to the new version properly?

    Thanks.
     
  8. Kementh

    Kementh

    Joined:
    Dec 13, 2012
    Posts:
    3
    Yeah, I'll mess about with it a bit, you go to bed,

    I'm in no rush so you can check back in the morning ;)

    [Edit]
    Well i've tried Clear() and starting a new Unity project and the bug still shows up in my code, but I agree I can't get it to manifest in the Demo world, so I'll try digging a little deeper Tommorow

    I Did mange to expose a different bug that may be related however, and it is easy to replicate in the Demo, If you set the horizontal gravity to 0, the axis eventually 'locks up' because the 'negative' and 'positive' buttons are both at 100 and never decrease. I do remember having to correct this when i hacked in my own axis gravity code for 2.4.5

    My work around was to include a few ifs to shunt the 'axis' value into the corresponding button, so at line 745 in the current code.

    Code (csharp):
    1.  
    2. float axisVal = _getAxis[pos] - _getAxis[neg];
    3. if (axisVal > 0) {
    4.     _getAxis[pos] = axisVal;
    5.     _getAxis[neg] = 0;
    6. } else if (axisVal < 0){
    7.     _getAxis[pos] = 0;
    8.     _getAxis[neg] = -axisVal;
    9. } else {
    10.     _getAxis[pos] = 0;
    11.     _getAxis[neg] = 0;
    12. }      
    13.  
     
    Last edited: Apr 17, 2013
  9. Deleted User

    Deleted User

    Guest

    Just out of curiosity, how you guys managed to solve the gui color issue?
     
  10. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    We tried several approaches and we couldn't find a proper way to bypass this (unity 4.x) bug.
    Unity accepted and managed to reproduce the bug and says they are working on it. How fast they couldn't tell so we decided we couldn't wait for it.

    We added a few color variants of the skin as temporary solution.
    you can use one of these color variants for now, or alternatively we added a grey colored version of the skin that you can recolor yourself in photoshop. This is not how we liked it to function but unfortunately this is for unity4 devs the only way to have it work right now.
    We hope unity will fix this bug asap and as soon this is the case we will push an update out so unity4 devs can have it working as intended.

    Unity3 devs can use bgColor as intended.

    Also, unity promised a new GUI system in unity4.x so as soon that is released we will adapt cGUI to use the new GUI system.
     
  11. Kementh

    Kementh

    Joined:
    Dec 13, 2012
    Posts:
    3
    I've managed to replicate the Axis Gravity bug in the demonstration code, Turns out Gravity is being set globally to the last 'axis' that is being called.

    setup.cs - Line 55
    Code (csharp):
    1.  
    2. cInput.SetAxisGravity("Vertical",0f); //added this
    3.  

    planes.cs - Lines 56,57
    Code (csharp):
    1.  
    2. float horizMovement = cInput.GetAxis("Horizontal");
    3. float vertMovement = cInput.GetAxis("Vertical"); //Added This
    4.  

    I'm not sure on an efficient fix, my work around was to assign a gravity value per input so that it matched the [n] value in checkInput()'s gravity section. but like my workaround for the maxing axis with low 0.0 button gravity it's probably adding alot of overhead in relation to the original functions.

    I Hope that this is of some use, for now I'll just go back to using my modified 2.4.5 Code. :)
     
  12. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    Wow, the modifier thing is huge. THANKS!!!

    The gravity features are very welcome as well.
     
  13. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Thanks Kementh for helping me duplicate the issue. I've found the problem. It's in GetAxis(). Individual axis sensitivity seems to suffer from the same issue as well. As you said, cInput is using the sensitivity and gravity for the last axis checked with GetAxis(). We're working on a solution for it.

    I'm glad you find the modifiers useful. It's been requested a lot.
     
    Last edited: Apr 18, 2013
  14. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Letting you guys know that 2.5.1 is submitted to the asset store which fixes the gravity/sensitivity issue.
    It should be live on the website.

    Deozaan will give more details later...
     
  15. 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 24 (business) hours. Hopefully it will get approved before the weekend. If you bought it from the website then the update is available right now.

    cInput changes:

    v2.5.1
    • Got individual axis gravity and sensitivity settings to work for reals. (Thanks Kementh)
    • Fixed bug where duplicate copies of same axis could be created.
     
  16. Deleted User

    Deleted User

    Guest

    Just an heads up on a warning I'm getting now with version 2.5.1 is nothing breaking, actually I don't see anything wrong even after inputting my custom axis, but I keep getting this all time now:

    Assets/Plugins/cMonkeys/cInput.cs(751,39): warning CS0219: The variable `axisAbs' is assigned but its value is never used

    This maybe could be caused from the fact that I totally got rid of the GUI stuff? As i'm using NGUI I built my own menu, so I just commented out your gui stuff from cInput.cs.
     
  17. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    Whoops! Looks like I left in a temporary variable. It has nothing to do with the GUI stuff. Everything will work as it should, there's just a temporary/local variable that I was using for testing and forgot to remove. You can comment out the line number the error message mentions where axisAbs is declared in the meantime. But that variable will be removed in the next cInput update. Sorry about that.

    And just a heads up in case you didn't notice with the new GUI changes in cInput 2.5.x is that you only have to comment out the very first line of cInput now to keep it from using it's own GUI.

    Code (csharp):
    1. #define Use_cInputGUI // Comment out this line to use your own GUI instead of cInput's built-in GUI.
     
    Last edited: Apr 19, 2013
  18. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Thanks to a tip of Neurologic the coloring of cGUI skins is properly working now in unity4.x and unity3.x !!!
    This update will be pushed after the weekend !
     
  19. Deleted User

    Deleted User

    Guest

    Oh I totally missed the define line, thanks for the heads up. And sorry for the nitpicking about the warning is just... I don't know, I like the console clean :).
     
  20. Deozaan

    Deozaan

    Joined:
    Oct 27, 2010
    Posts:
    707
    I understand. I feel the same way. :D
     
  21. OneThree

    OneThree

    Joined:
    Oct 28, 2011
    Posts:
    181
    Has anyone tried using this with uScript?

    I'm sure that most of the functions and properties would work via reflection without any additional support, but I'm curious about capturing cInput events. For example, a special node has to be added for NGUI so that uScript can detect NGUI's various events, but other than that NGUI works perfectly.

    I desperately want to replace Unity's input manager, which is pretty wretched and inaccessible, but I'd like to know if anyone has tried using cInput with uScript.

    Thanks!
     
  22. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    I don't think so Onethree, but this is on our todo list, together with playmaker. If someone allready have experience with this we are happy to work together on this.

    That said, we are working on a visual editor script ourself to setup cInput ! Expect it soon(ish).
    We allready have a editor script comming with cInput on the new update that automates the install. Just use the menu option and your ready (no more manually installing the file).

    So ye, v2.5.2 is ready ! Deozaan will post more details soon i think !.
     
  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 24 (business) hours. Hopefully it will get approved before the weekend. If you bought it from the website then the update is available right now.

    cInput changes:

    v2.5.2
    • Added Editor script to create the InputManager.asset file.
    • Removed unused variable which caused Editor warnings. (Thanks Neurological)
    • GUI color now works in both Unity 3.x and 4.x. (Thanks Neurological)
    • Added functions to remove modifiers. (Thanks xadhoom)
     
  24. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    Hi,

    I'm liking the looks of this asset :) am wondering if its possible to map Razer Hydra gyro accelerometers ? I ran your demo was able to map thumb, triggers buttons easily... but how about gyro ?

    I'm no code monkey... but I believe this could be in the Axis() method... yes ? which might not be showcased in the demo
     
  25. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Banksy,...

    We will upload a test demo for you so you can test the Gyro/accelerometers. If you are not able to set-up the Gyro/accelerometers in that demo then it's most likely that unity can't detect them.
    If unity can't detect them then cInput won't be neither.

    But stay tuned, we will upload a demo soon for you...
     
  26. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    Hi thanks for the reply :)

    Unity4 Pro detects the Razer Hydra's gyro, accelerometer buttons.
    I have full use of all buttons, gyros etc... I created a scene using Unity4 Pro

    Here's a video of if it in action...


    http://www.youtube.com/watch?v=lmQTgtWzSk8

    Look forward to testing the demo :)
     
    Last edited: Apr 26, 2013
  27. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Bansky, can you send us the input code thats related to the gyros and accelerometer ?
    This would make it a lot easier for us to make the demo.
     
  28. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    Hi, Ok so see below I have updated dropbox and sent you a link :)
     
    Last edited: Apr 28, 2013
  29. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    says the folder doesn't exist
     
  30. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    Ah ok... I need to e-mail you the link from within DropBox... Done :)

    note: You can always goto the asset store and download " Sixense " (its free ) all the input files are in there.
     
    Last edited: Apr 28, 2013
  31. OneThree

    OneThree

    Joined:
    Oct 28, 2011
    Posts:
    181
    If it helps, you can check out the NGUI event node for uScript here: http://www.tasharen.com/ngui/NGUIuScript.cs

    That's just for NGUI's events; uScript needs no special support for anything else because once a script is in a scene, uScript can access its properties and functions via reflection. I use a number of different plugins that have no explicit uScript support, and they all work perfectly via reflection. I don't know any reason that cInput wouldn't function just as well ...

    In order to capture events from a third-party plugin someone just has to create a wrapper node like the one for NGUI. Here are links to uScript's documentation, which should explain in more detail what is needed for a custom node. As I understand it the NGUI node took the NGUI guy like 5 seconds to create, since it's just a wrapper for existing events put into a format uScript can recognize.

    Doc Homepage: http://uscript.net/docs/index.php?title=Main_Page
    Event Node Documentation: http://docs.uscript.net/Development/#1.5-Creating_Event_Nodes.htm

    Anyway, I hope that's useful for you, and my fingers are crossed that creating an event node is a simple process. :)

    One last thing: the uScript developers are very responsive and active on their forums (http://uscript.net/forum/index.php), so if you wanted to get in touch with them I think a post in the 3rd Party Integration forum would get the ball rolling. I'm not a programmer; if I was I'd just create the node myself, but I'm glad to help any way I can because I really, really, really want to ditch Unity's wretched game launcher and replace it in my game with cInput!
     
  32. KeithT

    KeithT

    Joined:
    Nov 23, 2011
    Posts:
    83
    2.5.2 is a pain. CInput used to just work and suddenly stuff is depreceated on a minor, minor release and it's not clear what to replace it with, without wading through docs and engaging with something new called cGUI.

    30 frustrating minutes later the standard menu still does not appear after trying both Show and Toggle below ? This from the manual is confusing to say the least!

    ShowInputGUI "Displays the cInput GUI if cInput is in the project. Unless you're writing your own GUI, or specifically
    need to display the cInput GUI, you should probably just use ToggleGUI instead."

    It's a great product don't overcomplicate it.

    P.S. How do you open the standard menu that used to work with showMenu ?
     
  33. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Keith, try

    if (Input.GetKeyDown(KeyCode.Escape) !cInput.scanning) {
    cGUI.ToggleGUI();
    }

    cGUI.ToggleGUI(); toggles the menu on/off

    so everytime you call it when menu is not up, it will show the menu, calling it again wtill turn it off again.
    Sorry you find this confusing
     
  34. KeithT

    KeithT

    Joined:
    Nov 23, 2011
    Posts:
    83
    Hi,

    Thanks for the response and apologies for my frustration showing.....

    I have the below, which appears to be the same as yours and does not work....... I added your !cInput.scanning condition and no change.
    It's a new project with just cInput and NGUI in it......

    void Update(){
    if(Input.GetKeyDown(KeyCode.F2)){
    //cGUI.ShowInputGUI();
    cGUI.ToggleGUI();
    }
    }
     
  35. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    Hi... just checking if you managed to get the Razer Hydra "Sixense" input files.. I put them in my DropBox.
    I sent an e-mail with the dropbox address.
     
  36. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Hey KeithT , i'm just back home and i tried to reproduce your problem and indeed it seems the last cInput update broke something serious.
    We will try to fix this ASAP (like ,were working on it right now !). If you need the last working version we can send you that trough email.

    Send us yr asset store invoice nr or email us your paypal email if you bought trough the website and we email you the last working copy asap.

    We apoligize for this error and will fix this asap !
     
  37. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Hey Banksy, sorry i didn't reply to you yet, i've got the files allright ! We are looking into it still and will get back to you also as fast as we can but we need to fix a more urgent thing first as you can prolly see....
     
  38. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Ok , me here again, we've spotted our mistake... This problem happens because there is no skin setup by default.

    try setting the skin like this:
    Code (csharp):
    1.  
    2. public class setup : MonoBehaviour {
    3.     public GUISkin myskin;
    4.     public Color menuColor = new Color(0.09f, 0.77f, 1, 1);
    5.  
    6.     void Start () {
    7.         cInput.Init();
    8.         cGUI.cSkin = myskin;
    9.         cGUI.bgColor = menuColor;
    10.         cInput.SetKey("Shoot", Keys.S);
    11.     }
    12.     void Update () {
    13.         if (Input.GetKeyDown(KeyCode.F2)) {
    14.             cGUI.ToggleGUI();
    15.         }
    16.     }
    17. }
    18.  
    The skin can be found in cMonkeys/cGUI/Skins/
    if you use cGUI.bgColor, make sure you use the grey skin.

    We apoligize for this oversight and will try to fix this as soon we can,but for now you can set up the skin manual and then it works.
     
    Last edited: May 1, 2013
  39. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    Ok.. thanks for the update look forward to hearing from you again shortly.
     
  40. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Hey banksy. Deozaan made a demo for you. You can test it here

    Don't get your hopes up yet tough there we couldn't really test the sixense plugin there we don't have access to unity pro or the razor hardware.
    We just enabled a few settings that are allready builtin cInput but weren't enabled for the webdemo. Hopefully this works but honnestly we really just can't tell.
     
  41. 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 24 (business) hours. If you bought it from the website then the update is available right now.

    cInput changes:

    v2.5.3
    • Fixed cGUI not working when cSkin wasn't set. (Thanks KeithT)
    • Fixed trying to load from PlayerPrefs when there was nothing saved.
     
  42. ezone

    ezone

    Joined:
    Mar 28, 2008
    Posts:
    331
    Hi guys,

    I just purchased from the Asset Store and it is very nicely done!

    I have a suggestion that would really help me, and a lot of other android developers out there. With the proliferation of the Android 'unconsoles' (e.g. OUYA, GameStick, NVIDIA Shield, etc) it would be great if your plugin was able to detect which bluetooth controller/gamepad was connected and give us access to the controller via the cInput manager. Any plans for this? - cause I've been looking around and there isn't a Unity plugin out there that addresses this.
     
  43. Banksy

    Banksy

    Joined:
    Mar 31, 2013
    Posts:
    376
    I understand... I tried the Hydra demo found I can map all buttons on the hand controllers.... but because there is no button for the gyro it can't simply be accepted in the input menu. Normally you would tap the corresponding button... but in this case I guess an actual drop down list miht be required to choose for example " hand gyro" pitch x/y, roll yaw. Hope this helps...
    If you wish.... simply update each time I can test here.. or if it simply sounds way to complicated.. just let it go I'll understand :) but if you need someone to check the results .. I can be a tester since I have Unity Pro the Hydra.
     
  44. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Ezone, i'm not 100% sure what you are asking. Do you mean that your bluetooth controller that works in unity, doesn't work with cInput ? If so, let us know and we try to solve this asap. We don't provide additional drivers tought, we build upon the unity Input class and make this accessable/scriptable that normally aren't.
    I'm not 100% sure i understand your question tought, so please explain more if i'm understanding it wrong.
     
  45. Roidz99

    Roidz99

    Joined:
    Jul 8, 2010
    Posts:
    198
    Hey Banksy, thats really generous of you but we can't really build in features that we can't really test ourselfs. We can't rely on your kindness to keep helping us fix bugs etc... Other people might find bugs that are differend then yours.

    How much we like to build in extra features and support extra hardware, specially nice hardware as the Hydra, we think it's not a good idea to do this without being able to test this ourselfs properly.
    If this would just be having a few tweaks here and there then we could do this but this requires using external DLL's (that we can't use neither there we don't have access to unity pro) and requires a whole new approach.

    I hope you understand.
     
  46. Deleted User

    Deleted User

    Guest

    I think he is suggesting that cInput should have a feature that recognize what model of controller is plugged. Like if you plug a OUYA controller cInput recognize it and you have the options only for it to bind inputs.

    But I guess there is no point in doing that as is too game depending plus cInput have already all the joypad stuff in it, so is just a matter of the game designer to go about it.
     
  47. ezone

    ezone

    Joined:
    Mar 28, 2008
    Posts:
    331
    Thanks for getting back to me. I've got it all working now - it looks like OUYA and GameStick respond to 'Input.GetJoystickNames()' if you have a HID gamepad connected. I was using a Moga controller that wasn't being recognised unless the MogaPivot app was running first. All good now!
     
  48. SimonTBM

    SimonTBM

    Joined:
    May 10, 2013
    Posts:
    6
    Hello!

    I just have a couple of questions that anybody in here that knows the answer could reply to if you so please :)

    1. Can you map joysticks to be the default value of an input?
    2. How adaptable is cInput 2 to work with other GUI systems in Unity, instead of using OnGUI? (In this case, a heavily modified version of EZ-GUI)

    Any responses would be great, just want to see if this could save me from writing my own input managing system.

    Thanks! :)
     
  49. KeithT

    KeithT

    Joined:
    Nov 23, 2011
    Posts:
    83
    Has anyone integrated cinput2 with NGUI ?

    I think this will require changing the NGUI event management class UICamera ?

    @SimonTBM, similar issues methinks.
     
  50. mark-velthuis

    mark-velthuis

    Joined:
    Feb 10, 2011
    Posts:
    47
    I have a bit of difficulty setting up axis with modifiers.

    Given this piece of code :
    Code (csharp):
    1.  
    2. cInput.SetKey("forward", "UpArrow", Keys.None, Keys.None, Keys.None);
    3. cInput.SetKey("backward", "DownArrow", Keys.None, Keys.None, Keys.None);
    4. cInput.SetKey("left", "LeftArrow", Keys.None, Keys.None, Keys.None);
    5. cInput.SetKey("right", "RightArrow", Keys.None, Keys.None, Keys.None);
    6. cInput.SetAxis("move_vertical", "backward", "forward", 1);
    7. cInput.SetAxis("move_horizontal", "left", "right", 1);
    8.  
    9. cInput.SetKey("look_up", "UpArrow", "UpArrow", "LeftAlt", "RightAlt");
    10. cInput.SetKey("look_down", "DownArrow", "DownArrow", "LeftAlt", "RightAlt");
    11. cInput.SetKey("look_left", "LeftArrow", "LeftArrow", "LeftAlt", "RightAlt");
    12. cInput.SetKey("look_right", "RightArrow", "RightArrow", "LeftAlt", "RightAlt");
    13. cInput.SetAxis("look_vertical", "look_up", "look_down", 1);
    14. cInput.SetAxis("look_horizontal", "look_left", "look_right", 1);
    15.  
    The result is that when Alt is pressed, it correctly behaves and only the look axis react to the arrow keys.
    But when alt isn't pressed, both the look and the move axis react to the arrow keys, while I expected only the move axis would react.
    Normal buttons do seem to work though, so it looks like a problem with axis.

    I also have 2 suggestions/requests.
    I think it would be convenient to have the ability to set keys that don't show in the gui. I know the main point of the plugin is to have customizable input, but there's always a few exceptions.
    And would it be possible to get keycodes for Alt, Shift and Control without specifying left and right.