Fandom

Adventure Creator Wikia

Rewired integration

37pages on
this wiki
Add New Page
Comments0 Share

Notes: Attach the script to any active object in the hierarchy, which you know is always going to exist on every scene, or which doesn't get destroyed on loading (You may also put it on the AC persistent engine or game engine prefabs). Also, make sure your actions are correctly setup.

In Rewired, they need to have the exact same names as the AC inputs listed under the AC's Settings Manager. Make sure you don't have Unity inputs which may clash with your actions, too, or they will fight for control. So once the Rewired actions are setup you can delete your Unity inputs (in unity's input manager). For the rest follow Rewired's documentation.

using UnityEngine;
public class ACInputRewired : MonoBehaviour
{
  public int playerId = 0;
  private Rewired.Player player;

  void Start()
  {
    AC.KickStarter.playerInput.InputGetButtonDownDelegate = CustomGetButtonDown;
    AC.KickStarter.playerInput.InputGetButtonUpDelegate = CustomGetButtonUp;
    AC.KickStarter.playerInput.InputGetButtonDelegate = CustomGetButton;
    AC.KickStarter.playerInput.InputGetAxisDelegate = CustomGetAxis;
    player = Rewired.ReInput.players.GetPlayer(playerId);
  }

  private bool CustomGetButtonDown(string buttonName)
  {
    return player.GetButtonDown(buttonName);
  }

  private float CustomGetAxis(string AxisName)
  {
    return player.GetAxis(AxisName);
  }

  private bool CustomGetButton(string buttonName)
  {
    return player.GetButton(buttonName);
  }

  private bool CustomGetButtonUp(string buttonName)
  {
    return player.GetButtonUp(buttonName);
  }
}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.