[SOLVED] Can anyone help? CrossPlatformInput and InputManager

hi guys,

ok… deep breaths…

I’m trying to establish a basic connection with unities CrossPlatforInput (DuelTouchControls) and InputManager.

Im casting this to an android and i cant seem to get a simple cube moving left and right, jump etc.

This is the current code i have thats attached to my cube:

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class Player : MonoBehaviour {


	public float moveSpeed = 2;

	void Update () 
	{
		
		float moveHorizontal = Input.GetAxisRaw ("Horizontal");
		   if( moveHorizontal != 0.0f )
         {
		Vector3 movement = new Vector3(moveHorizontal, 0.0f, 0); 
		transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(-movement), 0.15F);
		 
}
}
}

I believe that i need to map it to the InputManager however i cant seem to figure out what the problem is…

87679-inputmanager.png

Can anyone help?

Hi,

First you have to include “CrossPlatformInput” method.

using UnityStandardAssets.CrossPlatformInput;

public class Player : MonoBehaviour {

 public float moveSpeed = 2;

 void Update () 
 {
     
     float moveHorizontal = Input.GetAxisRaw ("Horizontal");
      //here you can use
     float moveHorizontal = CrossPlatformInputManager.GetAxis ("Horizontal");
       //For Vertical use same line just by replace "Vertical" word.
        if( moveHorizontal != 0.0f )
      {
     Vector3 movement = new Vector3(moveHorizontal, 0.0f, 0); 
     transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(-movement), 0.15F);

}
}
}

Hope it will help you.