Adventure Creator Wikia
Register
Advertisement

NOTE: CN Controls has been deprecated - a similar script that works with Simple Touch Controller can be found here.

This script allows you to integrate the free CN Controls asset to AC.

Same as Rewired's integration, 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 PersistentEngine or GameEngine prefabs). Also, make sure CN Controls' Virtual Joystick is using "Vertical" and "Horizontal" as the input names.

using UnityEngine;
using CnControls;

public class ACInputCNControls : MonoBehaviour
{
  void Start()
  {
    //Call AC delegate for the joystick Axis
    AC.KickStarter.playerInput.InputGetAxisDelegate = CustomGetAxis;
  }

  private float CustomGetAxis(string AxisName)
  {
    //get the axis from CNControls' joystick
    return CnInputManager.GetAxis(AxisName);
  }
}


[]

Advertisement