using UnityEngine; using UnityStandardAssets.CrossPlatformInput; public class PlayerController : MonoBehaviour { private void Update() { if (CrossPlatformInputManager.GetButtonDown("Jump")) { // Code to make player jump } } }
using UnityEngine; using UnityStandardAssets.CrossPlatformInput; public class ShootingController : MonoBehaviour { private void Update() { if (Input.GetMouseButtonDown(0)) { CrossPlatformInputManager.SetButtonDown("Fire1"); } else if (Input.GetMouseButtonUp(0)) { CrossPlatformInputManager.SetButtonUp("Fire1"); } } }In this example, the SetButtonDown method is used to set the "Fire1" button to be in a "down" state when the left mouse button is pressed, and the SetButtonUp method is used to set the button back to an "up" state when the left mouse button is released. Package library: Unity Standard Assets