Forum rules - please read before posting.

Rewired AC Integration Script

2»

Comments

  • By how much is this affected by Rewired?  So long as your Input method is set to Keyboard And Controller, relying on the "first selected" properties within the Menu Manager should be enough to assume direct control.

    Also bear in mind that if your menu doesn't pause the game, you'll need to use the Engine: Manage systems Action when it turns on to allow direct control over it in-game.
  • I think it was pretty much 100% Rewired.  I didn't realize I needed the Engine: Manage Systems Action setup...so now that's working with my good ol' AC menu!  Hooray!

    Thanks, Chris!

  • Anyone have any experience triggering a Rewired Control Mapper UI screen from an AC menu and have it go back to the AC menu once you're done with your changes?
  • edited October 2018
    Realized I never came back to this thread to let people know how I did this.

    First, I installed Control Mapper into my scene:

    https://imgur.com/vOZ7voq

    Next, I created an AC menu that sent a custom message of "Open" to the ControlMapper gameobject:

    https://imgur.com/Jswt6w0

    Then I needed to create a custom script that would allow me to trigger an actionlist on a Control Mapper UI event, so I found this one on the AC forums:

    ---

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using AC;

    public class Trigger_AC_ActionList : MonoBehaviour {
        public AC.Cutscene myCutscene;
        public AC.ActionListAsset myActionListAsset;
        
        public void RunCutscene ()
        {
            myCutscene.Interact ();
        }

        public void RunActionListAsset ()
        {
            myActionListAsset.Interact ();
        }

    }  

    ---

    Added that script to a new gameobject and then created an Actionlist that sends a custom message of "Close" to the ControlMapper gameobject:

    https://imgur.com/FS6UdN5

    Then I had to find the "DoneButton" object within the ControlMapper gameobject which is the UI button that confirms that you are finished with your changes when making input adjustments on the Control Mapper screen.  From there, I added a new event on the "On Click()" call and pointed it to my new gameobject that references the custom actionlist and triggered it on the "Trigger_AC_ActionList.RunCutscene" behavior:

    https://imgur.com/vAkaSSH

    After that, I just customized my Control Mapper screen to how I wanted it and made sure all of my changes were being saved.

    Hopefully, that helps some people!
    -z


  • Thanks, @themightyzq! I got it working.

    I was wondering about the need to Send Message:Close action to close ControlMapper. When you click on Done in the ControlMapper menu, functionality already seems to be built into it for ControlMapper to close. Was this not the case for you? It throws an error when I try to use the Send Message:Close action per the setup above, but since it closes without it I was going to remove it, and I wanted to make sure I'm not missing something where that action is needed.

  • I'd have to look at my setup again, but you might be able to get away with not using the close action!

  • Hello guys! I've been hammering my head against the wall with Rewired for couple of nights. I got the thing working with Adventure Creator, but only in individual scenes. Once the scene changes, I lose all input. This happens both in editor and on individual builds. What am I doing wrong here? How exactly should the inputs be removed from the Unity's own Input Manager? When I try to remove Menu, AC wants to make a new one.

  • edited October 2020

    @ramboaslak Do you have your Rewired Input Manager prefab in every scene? That needs to be in there in order for Rewired to handle input throughout the entire game. Also, you could try reinstalling Rewired (https://guavaman.com/projects/rewired/docs/Installation.html). It should take care of handling taking over input from the standard Unity input during setup.

  • The "Menu" input is hard-wired as a requirement for AC - but what it's mapped to isn't. If you don't want to rely on it, you can keep it listed but with nothing entered into the "Positive Button" etc fields.

  • Thanks a bunch, I got Rewired working. But now I've ran into another issue: Analog stick works fine in Unity, but when I run a build of the game, the axis are mirrored, and the main character doesn't move anywhere. D-pad works just fine, but the analog stick not at all. I'm pretty sure that this is an issue with how I've configured the Input Manager of Rewired, but do you guys have a suggestion how this could be resolved? Making a build for testing different controller settings is something that I'd like to avoid :smiley:

  • It's a funny thing. Once I post about a problem, I found a solution. Horizontal and vertical axes were configured wrong, and once I figured this out, it was smooth sailing. Thanks for your help :smile:

  • @ramboaslak @ChrisIceBox

    Hello! I'm in partly the same boat but it seems you got future than me.

    I am using Unity 2019.4.9F1, I downloaded the latest version of AC 1.72.3 and the latest version of Rewired 1.1.36.1

    I then went through the AC Wizard and created a Point and Click and set the Input Method to "Keyboard Or Controller"

    Set Tin Pot as my Player

    My Input Manager shows 495 entries ( Rewired default plus the one from AC which is Menu )

    Now, I went to Rewired, Window->Rewired->Create->Input Manager in Scene

    Click Launched Rewired Editor on the Rewired Input Manager

    Set up my Player as Player0, set all my Actions to match AC list that it requires, click Joystick Maps, selected XBox One Controller and set the Actions to the Buttons. Went back to Players, selected Player0 and Add joystick Map.

    Visited the link https://adventure-creator.fandom.com/wiki/Rewired_integration and copied and pasted the code. Attached it to the Rewired Input Manager.

    When I hit Play, I give focus to the Game Window and the controller doesn't do anything. The cursor doesn't move, the A/B buttons don't work. It's like it's not doing anything.

    I wrote my own code to validate that it's getting calls from the XBox One Controller and it's fine. It just doesn't like AC for some reason.

    I'm open to suggestions if I missed a step somewhere.

    Thanks!

  • For your given AC Settings, you'd need axes named CursorHorizontal and CursorVertical, and a button named InteractionA to move - these are named as such in the Rewired Input Manager? And they're not defined also in Unity's Input Manager?

    So long as the wiki script is present in the scene, it should work then. You can try placing some Debug.Log statements to see where things are going wrong. For example, replace the script's CustomGetAxis function with:

    private float CustomGetAxis(string AxisName)
    {
        Debug.Log ("Request axis '" + AxisName + "' - Rewired value: " + player.GetAxis(AxisName));
        return player.GetAxis(AxisName);
    }
    

    What does the Console report when moving the thumbstick then?

  • @ChrisIceBox

    It was quite odd. Basically it's a Rewired issue. I had to put the values in for XBox 360 Controller since it was not working for XBox One Controller.

    I plan in doing a video of putting this all of this together so it will help other people too.

    Thanks Chris.

  • @matrix211v1

    Alternatively, you can use the Gamepad Template to assign your inputs. This way it will propagate down to all controllers with a similar layout and you don't have to map multiple controllers. I think this is the recommended method from the Rewired documentation.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.