+3

Rewired Full Integration (Native Units + Events)

JasonJonesLASM 3 years ago updated 3 years ago 10



Today I bring to you a full native integration for Rewired in Bolt. Other event types can't be used in Bolt just yet out of the box, so I had to bring this functionality in by learning the API. I wanted to take the time to make Input just as easy with the best input plugin on the market, Rewired, as input with the Unity based solution.


With this integration, you just need to add in the UnityPackage, and regenerate your units and inspectors. No need to add any assemblies or types. This is truly native, and will be faster than using reflection. All units that take an Action Name or Id, or Player Name or Id, have a switch to change ports on the unit. Get player, also obfuscates the need to get the player manually from All Players.

Here is the Fuzzy Finder layout as of Beta R1.

  • Events > Input > Rewired


    • On Triggered Action
    • On Controller Connect
    • On Controller Disconnect
    • On Controller Pre-Disconnected
  • Variables > Rewired


    • Get Player
    • Get Players
    • Controller Type Literal
    • Update Loop Type Literal
  • Math > Rewired
    • Get Axis
    • Get Axis Prev
    • Get Axis Delta
    • Get Axis Raw Prev
    • Get Axis Raw Delta
    • Get Axis Time Active
    • Get Axis Time Inactive
    • Get Axis Raw Time Active
    • Get Axis Raw Time Inactive
    • Get Axis Coordinate Mode
    • Get Axis Coordinate Mode Prev
    • Get Axis Raw Coordinate Mode
    • Get Axis Raw Coordinate Mode Prev
    • Axis Coordinate Mode Literal




All updates will be available in the comments below. I really looking for feedback from users of both, so help me to make this better.

Next Update:
  • Add new event icons for On Controller Connect, Disconnect, and Pre-Disconnect.
  • Add all Get Button return units.
  • Add Map switching support.
Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Above and beyond Jason, nicely done

You may want to consider reaching out to Rewired's dev and show him what you did, he may be interested in doing a direct integration.

Thank you sir! 

When I first started I actually did reach out to him. He  loved it and will include a link on the Rewired website and in the documentation as soon as my website is up with the dedicated page. We talked about including in Rewired as well, but he hasn't used Bolt yet, so going to be some time before we talk about that again.

Might be better this way since I am more exclusively involved with Bolt and can update faster.

+1

True, At least it is on his radar.

+1



NEW UPDATE - Beta R2

* WARNING: There were too many errors due to serialization processes and not assigning the dlls properly, but this has been fixed for now and forever(?) into the future. The units you have now will lose there connections though. This is necessary, as you couldn't even do a proper build before. The structure has been changed as well to keep everything separated . Hope it's not too far along for anyone and is manageable to fix your graphs.*

ADDITIONS

CHANGES

  • Reordered category listing. Everything is now nicely layed out in each folder with similar types listed together. Logic > Rewired has been added as well.

FIXES

  • Folder structure has been fixed and changed to better help organize and bundle editors and run-time functions separately. It was necessary for many different plugins to be developed without overreaching, and to make updating quicker and easier.
  • UnitHeaderBool removed, and replaced with a regular bool toggled to the left. 
  • Serialization and attributes fixed to prevent build and play mode errors.


UPGRADE INSTRUCTIONS

Make sure you delete your old LifeandStyleMedia folder from the project pane. This update is the only time you will have to do this. You will get errors if anything hangs around. Then download the package below, and install it. Once installed make sure to upgrade your unit options first, then generate custom inspectors.

Enjoy!



+1

New Update R2.1

I realized why I had a bug, and it was a dumb mistake on my part, where trying to get the private variables in unit options threw an error with Rewired. Therefore, everything I have done seemed to be irrelevant outside of the event system. Speeding it up probably helped a very little, but for everyone else who had an okay time importing Rewired_Core and types, this probably bloated your searches. So if you prefer just the events system, you can now download that, and I labeled another one extras, if you want the player helper, and native unit implementations of the various methods you can get that too. 

*NOTE: LifeandStyleMedia Folder should be dragged into plugins to match up with these packages. Just trying to keep it clean and out of the way.

Events Integration:
http://www.lifeandstylemedia.com/uploads/bolt/RewiredIntegration.unitypackage

Player Helpers and Native Versions of the reflected units:
http://www.lifeandstylemedia.com/uploads/bolt/RewiredIntegration_Extras.unitypackage

+1

Thank you everyone who tested this out, it was a great learning experience, as it was my first API release. It is now marked as obsolete, because Gauvaman has made an automatic events to units API for Bolt. There is way more events, as it has all of them! Way better. Here is a link to the instructions on setup. It will come right with the new version that came out yesterday: http://guavaman.com/projects/rewired/docs/Integration.html#Bolt

Augie of Gauvamana and Lazlo taught me a lot of what to do and not do that will help a lot going forward, so I'll be more focused on real classes and adding into type options like normal, instead of inheriting from Unit itself.  There are circumstances where it makes sense to go straight API, like my execution stuff, and stuff where you have to change layouts on units with options. Events are another story as well as some other coding practices you can't do, but I'd love to start making more macros! Think this will help people learn better anyways. Since you can jump right into what is going on, and even make changes. This comes with the fact 2.0 will have conversion to C#, and I don't want to miss out on the best with speed and flow.

Bonus events template :  MyEventUnit.cs

I've set up Rewires API but cannot find units to accomplish what you created here. Would you mind emailing me to go over their API as I see you use Rewired pretty extensively?

I'm on discord if you are (much faster communication) or email info@lifeandstylemedia.com (seem to get a little delay since I reroute to another address for my convenience). Anyway here's an overview of making it work.

Install rewired, then goto Window > Rewired > Integration > Bolt > Install Integration Pack.

After that go into Bolts Unit Options Wizard. Add Rewired_Core and Rewired_Bolt_Runtime to your assemblies. Click next and add Player, Controller, ReInput, Reinput.PlayerHelper, InputActionEventData and ControllerStatusChangedEventArgs.

Generate.

That's it. Now all the events will be there, about 10 times the amount that I had and no unnecessary extras. It's pretty amazing. If your having trouble finding things, there is only two locations in the fuzzy finder.

Events > Input > Rewired

and

Codebase > Rewired

I tried emailing you, it bounced back saying undeliverable. You can email me at:  MY EMAIL


I added everything except for ReInput, it's not in the list for me to add. There is ReInput.*  but not just ReInput by itself. The issue I'm having is that I cannot obtain the Player using ReInput.PlayerHelper.GetPlayer

This always gives a warning that it's missing the target player, which makes no sense to me seeing as this function as I understand it is supposed to get the player using the ID int value. Am I missing something?

You need to goto bolt editor preferences?? Wherever Aot Safe Mode is and uncheck it. Until C# generated happens in 2.0, it's unusable with those in Aot Mode, because they are I believe interfaces. Once you do that, they are available.

I'll snag a photo of it working as soon as I get back to my computer, so you can see if your missing something.