Hi, everyone. I was wondering how to adapt the virtual joystick from this free asset (https://www.assetstore.unity3d.com/en/#!/content/15233), named CN controls, to use it with AC. Having used rewired in another project I'm working on, I tried to copy cat the method for the integration, using the delegates, but it didn't seem to work. (By the way, I'm not using rewired in this project). Here is the code I used:
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);
}
void Update ()
{
//this simply adds Accept and Cancel Functionality
if (Input.GetButtonDown("cancel")){
AC.KickStarter.playerInteraction.DeselectHotspot ();
AC.KickStarter.playerMenus.SetInteractionMenus (false);
}
}
}
Would anyone enlighten me with the correct way to do this? --EDIT: I'm assuming the code is wrong, or maybe the joystick script is the one that needs to be changed?. Also, I'm not sure if I'm using the wrong AC settings? I'm currently using direct control/ mouse and keyboard-- Anyways, like I've said before, I'm not much of a programmer, more of a designer/writer/artist. And I like the feel of the joystick in this asset. So, as always, any advice would be greatly appreciated.
PS#1: The game will have exploration and some light platforming and other stuff so regular drag movement setting is too imprecise. Edit: And I can't seem to disable drag movement if I set the controls to touch?
PS#2: I'm hoping to make this game cross platform, the primary intended platform is mobile, but if possible I'd like to put it on PC too. So, if possible I'd like to keep the underlying inputs as Direct Control: Mouse and keyboard. But, if anyone has a better idea, I'll appreciate it.
Comments