Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Rewired - Advanced Input for Unity

Discussion in 'Assets and Asset Store' started by guavaman, Sep 25, 2014.

  1. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Hi,

    Your choice of GUI system won't have any bearing on the virtual controls really. Rewired's support for on-screen controls is done through the CustomController class which allows you to create a series of virtual controllers in the Rewired editor with your choice of the number of buttons and axes, then you feed those axes and buttons updated information each frame either using callbacks or via subscribing to an event from which you can push the updates into the elements. Once you have the elements updating every frame from your supplied values, you can just get input as normally using player.GetAxis("ActionName") or player.GetButton("ActionName) (and other related methods).

    Please see the docs section on Custom Controllers for more info: http://guavaman.com/projects/rewired/docs/CustomControllers.html

    If you want to see a code example of how this is done, let me know.

    Thanks!
     
  2. BuildABurgerBurg

    BuildABurgerBurg

    Joined:
    Nov 5, 2012
    Posts:
    566
    Thanks again.

    What would be very helpful for me and others is too setup a demo scene showing your system with uGui (virtual stick). I think it would be easy for you right?

    You would be the only one that on the asset store to have done this.

    I've purchased several of these kits on store. The plan is to use two of them, but unfortunately its a pain in ass to get working with Unity uGui.

    If you set this demo up then I will definitely purchase it.

    Kind Regards
    Mohoe
     
  3. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    While that would be nice to offer, it isn't the point of the demo to be a drop-in touch controller. The demo is meant to show you how to take any float or boolean input sources and use them to drive a CustomController's elements (in this case an on-screen touch controller). The implementation of the touch controller itself isn't the point of the demo.

    It sounds like you may be looking for is a drop-in touch controller to use in your game that uses uGUI. That may be something I could add in the future, but right now that will be left up to the developer to implement. A fully-functional, ready-to-use touch controller requires a lot more features and a lot more customizability for all the various use cases than what is or would be included in a demo.
     
    Last edited: Nov 13, 2014
  4. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Get a free trial of Rewired now! Contact me via the support form on the website.
     
  5. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    That is will definitely help people make a decision. Good work.
     
  6. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Sent you a message on the website, but I think this may be relevant for others as well:

    Q: Can / will you provide the source code currently wrapped in DLLs? We do rely a bit on external code for a project (not much though) and as attractive as Rewired seems (it would save us a lot of time) not having access to code is a dealbreaker. We have been in situations before when 3rd party code we relied on broke for some reason and we could not debug or fix the issue swiftly. That is a really dangerous situation to be in.

    TIA!
     
  7. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Hi Foxxis,

    Thanks for asking! There is no plan to offer a source code option for Rewired. I do understand your concerns, however, and I can only say that I stand by my work and will continue to improve it over time. I've been working in Unity for over 5 years now with published assets on the store for over a year now. I plan to continue working in Unity for the foreseeable future and will do my best to keep up with the changes as they come along. In my web development business I still support a couple of websites that were made 10 years ago, so I know something about long term support.
     
  8. Foxxis

    Foxxis

    Joined:
    Jun 27, 2006
    Posts:
    1,108
    Thank you for the answer!

    Please let me state that I do not doubt your professionalism or commitment. However, it is still an exposure to risk for several reasons and one I am not willing to accept again. Just the added difficulty of finding sources of bugs when adding DLLs to the mix makes me very wary.

    Good luck with the project though, as I wrote earlier it does look impressive!
     
    guavaman likes this.
  9. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    847
    So... following the quick tutorial I had my keyboard inputs set up in no time - not that my game requires an abundance of keys but it was good as an introduction to the basic principles of Rewired.

    Could you please point me in the general direction of how to set up touch input?
     
  10. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Hi c-Row,

    On-screen joystick touch input in Rewired is handled through use of Custom Controllers.

    The documentation on this topic:
    Custom Controllers
    How To's - Creating On-Screen Touch Controllers

    Quick overview:
    1. Set up one or more Custom Controllers in the Rewired Input Manager defining the number of axes and buttons you need for each.
    2. Assign the Custom Controller to a Player in the Rewired Input Manager.
    3. You will have to provide the on-screen controls which you will use to feed axis and button data into the Custom Controller. Once you have the data for the elements fed in, you can get touch input in the same way you would any other joystick control -- player.GetAxis, player.GetButton, etc.

    The example mentioned in the How To's link above shows you how to get it working., but the on-screen touch joystick elements themselves aren't intended to be production ready. You could modify them for your needs, create your own, or use existing touch controls on the asset store and use them to feed the CustomController.

    If you're looking for other types of touch input such as swiping, pinch zooming, and other gestures, Rewired doesn't handle that kind of touch input directly at present. (It would be conceivable to use a CustomController in that situation as well though to bridge the gap and associate gestures or any other kind of float or boolean data to Rewired Actions.)
     
  11. judah4

    judah4

    Joined:
    Feb 6, 2011
    Posts:
    256
    Hi, I have a quick question, does this support extra key mapping for keyboards with extra keys like on razer keyboards?
     
  12. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    At this point, if they're not mappable with Unity's KeyCodes, they're not mappable in Rewired. I have plans on doing native keyboard input at some point in the future but that's not available at present.
     
  13. gegagome

    gegagome

    Joined:
    Oct 11, 2012
    Posts:
    392
    I am considering buying Rewired for near future projects, but for the time being my app uses touch in the form of events when tapping and dragging using EasyTouch.

    In your videos there is no mention of wiring games using Rewired with touch.

    Would you please explain how Rewired handles touch? Is it the same as in with EasyTouch?

    Anxious to hear from you before sale expires

    Thanks
     
  14. judah4

    judah4

    Joined:
    Feb 6, 2011
    Posts:
    256
    hmmm, thank you for the reply. I really like what rewired does and I look forward to more features
     
    guavaman likes this.
  15. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Last edited: Dec 3, 2014
    judah4 likes this.
  16. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Hi,

    The message posted 3 above yours is about touch input: http://forum.unity3d.com/threads/rewired-advanced-input-for-unity.270693/page-3#post-1863837

    Rewired handles touch through the CustomController class which lets you feed any arbitrary float or Boolean value into the system and handle it as an axis/button value for an Action. There aren't any included touch controllers that detect swipes, drags, pinch zooms, etc. at this point. Instead, you can make your own or use existing controls on the asset store and then feed the Rewired CustomController elements the data so you can associate them to Actions.

    I may be adding actual drop-in touch controls in the future, but there are a number of other items on the radar which will be addressed first. Thanks!
     
  17. gurayg

    gurayg

    Joined:
    Nov 28, 2013
    Posts:
    269
    Hi,
    As you probably know, Unity 5 will offer some improvements to its input system.

    What do you thing about those from Rewire's perspective?
    Do they offer more improvements for Rewire?
    Will you be updating Rewire to Unity 5?

    Thanks
     
  18. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Unity 5's new input system is a ways off, but when more is known about it, I will definitely be looking at it. Looking at the official new input system thread, Rewired already supports most of the features they're planning to add. Still, I expect that it will add some new features that Rewired will be able to inherit and benefit from such as (hopefully) fixing a huge number of problems on other platforms (the ones Rewired falls back to Unity input as the input source such as Android, Linux, iOS, etc.). Obviously, the new input system will not just be fixes on the current one but a complete replacement, likely existing side by side with the old input system for a few years. If this is the case, I will add the option in Rewired to use the new input system as an input source and you should then still be able to use all of Rewired's existing systems on top of that.

    Rewired will definitely be updated for Unity 5, but at this point, the betas change with every release and it's not feasible to keep patching Rewired for every change Unity makes while it's in beta. The last I tested, Rewired worked in Unity 5 beta, but full support will not come until Unity 5 is released.

    Thanks!
     
    Last edited: Dec 3, 2014
  19. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    This may have already been covered, but can Rewired nicely support the same controller requiring different mappings on different platforms?

    I just did the input for my current project, but this looks sweet and I'm sorely tempted to re-do it. I had wanted something that replaced the input system rather than just wrapped it.

    On that note, any chance that you'll extend the asset to also replace the input system, rather than wrap it, for other platforms as well?
     
  20. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Hi,

    Edit: Wait, I may have misunderstood this question. Can you clarify? Do you mean can you make a different map for Xbox 360 controller on PC vs Xbox 360 on OSX? Like A = Fire on PC and B = Fire on OSX. If so, no, you can't directly (you could copy your Rewired Input Manager and enable only the one for that platform with the minor changes though). But if you meant does it make those controller's elements consistent across all platforms, then yes.

    For recognized controllers. See the list here.

    The controller definitions help to solve the problems with controllers behaving differently on the various platforms. In addition, controller templates allow you to make a map only once and have it apply to all controllers compatible with that template on all platforms. For example, map the Dual Analog Gamepad template and all the gamepad-type controllers will be mapped. This even works for gamepads that may have axes as triggers where others have buttons for triggers. At runtime, the template map is converted into a map specifically for that controller so that controller's human-readable element names will be displayed which you can use for user mapping screens or for help messages.

    For unrecognized controllers, it will be up to the user to map their controls through a user-mapping screen implementation. You can also map the Unknown Controller map which provides a basic 32 axis, 128 button map.

    It depends. I do plan on adding some other native input sources such as Moga for Android, but I haven't received any requests for other native platforms. Personally I would like to do Linux, but I haven't seen any interest in this yet. The other issue I'm considering is that Unity supports 17 platforms at last count which would be an immense tasks to try to support. I know they're working on a new input system to be released some time in the Unity 5 branch, and I'm hoping they'll fix some of the fundamental problems on all these platforms. If they do, at that point I can add Unity 5 input as another input source and inherit those fixes without having to re-invent the wheel on those 14 other platforms.
     
  21. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    Looks good. About to buy. +1 for integrated Ouya support, please!

    Background: I'm yet another one who's written his own wrapping input system for local multiplayer but always wanted ... more. (I dread going back to that code :-\ ) Ouya is SnwScf's first release platform hence my +1.
    Crossing fingers and taking the plunge!

    Thanks!
     
  22. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    I can't remember the exact example, but the indices for different parts of the Xbox 360 controller were different on Windows and OS X last time I made something with that hardware config. It sounds like you've abstracted away the indices, so I'm guessing that it's a non-issue with your system.
     
  23. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Hi Arkade,

    What's your release date for Snowman Scuffle? Your site says XMas 2014. I'll definitely not be able to get to Ouya support before then as I've got a very time-sensitive project I'm working on right now that must be done by Christmas. I'll look into the Ouya SDK and gauge the time it might take to implement. Likely I won't have time to get to that until Feb most likely as there are a number of other additions I'd like to do first (finish implementing frame-rate independent input, add some 4.6 GUI user mapping screens, and some other things.)
     
    Arkade likes this.
  24. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Ahh, yes. That's a big issue on all platforms and Rewired handles that very well. All those controllers on the page I linked to are mapped to be consistent across the platforms listed. With Rewired, you map Actions to named Elements. Each element is then mapped back to a hardware element index by the Hardware Joystick Map based on the controller definition for the current platform. So unless you're making a new controller definition, you never have to worry about axis and button indices.
     
    angrypenguin likes this.
  25. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    Awesome.

    Is there support for hardware element remapping at runtime? Eg: can I allow a user to specify their own "Left Stick X" if they're using an unsupported gamepad? Or, perhaps better, can I let them remap their controls based on generic axis names (eg, instead of "Left Stick X" it might just be "Axis 0")?

    It's not a big deal for my current project, but it might be handy going forward.
     
  26. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    If they're using an unsupported gamepad, it will automatically load a blank Unknown Controller map which is a generic map that supports 32 axes and 128 buttons. The axes and buttons will point to the hardware axes and buttons in the order they are defined by the HID information. So if you make a map for the Unknown Controller, you can assign those axes and buttons to Actions. If you don't make a map, it will still use the Unknown Controller profile and load a blank map for it. If you create a user mapping screen, you can then allow the user to assign controls based on button press or axis movement and be able to assign everything. In this way, Rewired supports all USB devices that use standard HID usages even if they're unknown. (Devices that require their own SDK such as 3D Connexion mouse, etc. are not [yet] supported because they use custom HID usages for their data.)

    So in the case of an unknown controller, the user will see "Axis 0" and "Button 0" instead of "Left Stick X".

    I wasn't sure if you were also asking if you could create an in-game user mapping system for your players to remap their controllers at runtime, but if that's what you're asking the answer is absolutely. There's a full featured example included with Rewired that shows how to do all kinds of mapping, calibration, saving/loading maps to XML, and much more. It uses the old GUI system currently, but I'm planning to add a set of remapping screens with uGUI probably in January. Really, it's meant to be an example for you to dissect and learn the API from rather than a drop-in.
     
    angrypenguin likes this.
  27. Arkade

    Arkade

    Joined:
    Oct 11, 2012
    Posts:
    654
    That's cool. I understand 1 customer's request can't define priorities - just wanted to register the desire. My own stuff does/will suffice until. Sooner = better, obviously ;-)

    I'm also a Linux user so that's obviously in my release list in time, too. Good to hear! (I imagine anyone targeting Steam considers this desirable these days?)
     
    guavaman likes this.
  28. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,614
    I was generally asking whether or not there's support for arbitrary mappings on generic/unknown hardware, which it sounds like there is.

    Sounds like a great system.
     
  29. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Okay, then yes. And the best part is that these maps can be saved to XML and loaded as well even if you don't provide a generic Unknown Controller map and the user just defines the controls themselves. That way, even if they're using 5 different controllers that are all unknown, you can still save their customized profiles for each controller and load it back the next time they play with it.
     
  30. Steve-Tack

    Steve-Tack

    Joined:
    Mar 12, 2013
    Posts:
    1,240
    I feel a little weird posting this, since I already posted a glowing review on the asset store. Too much? The thing is, I really am that enthused about an input manager. :)

    There are some assets that are "bread and butter" assets that almost any Unity project is going to need. To me those are: an audio manager, an object pool manager, and a civilized input system. Until 4.6, I would have included a UI system.

    For audio I use Master Audio and for object pooling I use PoolManager. I suppose if you're doing strictly mobile games that will only ever use tilt and touch controls, you don't necessarily need an input system. But if you're doing a PC game and need to support multiple input devices and/or there's any chance you're going to port it to another platform, you want an input manager.

    So I now have another bread-and-butter asset and that's Rewired. It's almost embarrassing how much of a fanboy I've become. I've felt the pain of trying to support multiple devices on my PC game is the thing. I wanted out-of-the-box support for a lot of gamepads as well as a flexible system for allowing in-game remapping of controls. Now I have what I always wanted in Unity. I can even do gamepad rumble on 360 pads. Seeing a game work with multiple gamepad support on PC also work on the Vita with no extra work is a trip. Seeing flight sticks work. Setting up keyboard, mouse, and joystick actions in a totally logical and flexible way is just a great feeling.
     
    guavaman likes this.
  31. Kiori

    Kiori

    Joined:
    Jun 25, 2014
    Posts:
    161
    You really should add native linux support, I mean it shouldn't be hard considering its open-source stuff. And with SteamOS right around the corner it will certainly be omega useful in the near future.

    Asset looks great btw.
    I'm also gonna be looking to use it with touch on mobile. So +1 to having a uGui drop in for ease of use, and other solutions.
     
    Arkade likes this.
  32. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Hey there! I bought this asset right now and on Import I get these two errors:

     
  33. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    What version of Unity are you using?

    I suspect you have a class in your project called "Platform" that is overriding the Rewired enum of the same name in its namespace. If you have a class called "Platform" in the global namespace this could happen. You will have to change the name of the class or put it inside a namespace.
     
    Last edited: Dec 3, 2014
  34. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Thanks!

    Re: Native Linux support

    "Easy" is definitely relative. Adding a new native platform usually takes at least a couple of weeks. SteamOS is a reason that this may be a good idea though.
     
  35. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Unity Version: (4.6.0f3)

    And yep, indeed! There is a another Third-Party-Plugin with the same class name.
    Can I rename your Class to something like RewiredPlatform?
     
  36. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    They're defined in the DLL so no, you can't change them. They're serialized in one object anyway, so you'd corrupt the data doing that.

    The other plugin needs to be modified if possible. It really shouldn't be putting things in the global namespace.
     
  37. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    Aye, renamed the other class, everythings fine now! :)
    Thanks for the quick replies!
     
    guavaman likes this.
  38. movra

    movra

    Joined:
    Feb 16, 2013
    Posts:
    566
    Although I agree about not using the global namespace, isn't it possible to add the line "using Platform = Rewired.Platforms.Platform;" to InputManager.cs?
     
  39. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Sure, but the next time he updates Rewired he'll have to do it again. I suppose the same will be true of the other plugin as well though.
     
  40. super-cypher

    super-cypher

    Joined:
    May 10, 2014
    Posts:
    117
    hi
    does this come with playmaker support? if not any plans for it soon?

    cheers.
     
  41. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    No, it doesn't have Playmaker support currently. I am planning on adding it eventually, but have some other things I'd like to add before I can get to it. The API is pretty huge, so Playmaker support will likely not cover everything possible in Rewired (control remapping being unlikely through PlayMaker). I'm also planning on adding Behavior Designer support.
     
  42. super-cypher

    super-cypher

    Joined:
    May 10, 2014
    Posts:
    117
    hey guavaman

    when you say eventually, how long are we talking' roughly'? if its not too long then i will buy it today.

    thanks.
     
  43. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    I probably can't start on it until February at the earliest. I can't make any promises about that timeframe as there are other things in the queue (not necessarily in order):
    • Framerate independent input (this is 1st priority since it's in progress)
    • Unity GUI remapping screens
    • Integrations (UFPS, PlayMaker, Behavior Designer)
    • Ouya support
    • Moga support
    • Possible native Linux support
    • Multi-mouse and multi-keyboard support
    • Native keyboard support
    • Native mouse support on OSX
    • Drop-in touch controls (on screen joystick, swipe, etc.)
    • Others
    I need to do some triage and prioritize these. The sale today has brought a ton of new customers and a lot of new requests along with it. Check back here for updates.
     
    Last edited: Dec 3, 2014
  44. BTStone

    BTStone

    Joined:
    Mar 10, 2012
    Posts:
    1,422
    How about you make a Trello as a Roadmap and FeatureRequests? :)
     
  45. super-cypher

    super-cypher

    Joined:
    May 10, 2014
    Posts:
    117
    ok i can live with that. remember the playmaker market is 'HUGE' and they are the very people that buy plugins like this, so its massively in your favor to do them. Many apps that add playmaker, become the most popular in my experience.

    illl buy it now!

    cheers
     
  46. HKSpadez

    HKSpadez

    Joined:
    Apr 24, 2013
    Posts:
    87
    using InControl right now but having some problems with multiplayer and when my old xbox controllers disconnect due to my crappy battery holders which flagging tons of errors.

    just bought this. going to give it a shot. will take some time to convert everything from incontrol -> rewired. but looking forward to a cleaner solution. hope this doesnt dissapoint XD will follow up with a review when i finish.
     
  47. nukeD

    nukeD

    Joined:
    Feb 12, 2009
    Posts:
    411
    Rewired looks amazing!
    I'm one of those PlayMaker users that buy plugins like this. I'll skip this promotion, but rest assured i'll get it once you manage to add PM support!

    Keep it up!
     
  48. longroadhwy

    longroadhwy

    Joined:
    May 4, 2014
    Posts:
    1,551
    That is interesting to hear about using Vita platform without any extra work.

    What Flight sticks are you using? Are you using Saitek or CH?

    It is all about being productive and I think everyone can be a fan of being more productive when using Rewired.
     
  49. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Thanks so much for your glowing reviews Steve! It makes me excited to see others so happy and excited about my work. :) I'm really pleased it's worked so well for you and thanks so much for helping spread the word!
     
  50. guavaman

    guavaman

    Joined:
    Nov 20, 2009
    Posts:
    5,605
    Now that there are so many new Rewired users, that's a very good idea. Thanks!

    I agree, integration with packages like PM, BD, and UFPS are very important because so many people use these systems and flawless input is critical to a good user experience. I'll try to get to these as quickly as I can!

    Excellent! Let me know how it goes. I'm sure you'll be pleased.

    Thanks for the input!