I have an object, which when triggered by the player has to swap the selected player’s left and right controls. The controls:
using UnityEngine;
using System.Collections;
using character;
using UnityStandardAssets.CrossPlatformInput;
public class confuse_powerup : MonoBehaviour {
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.name == "player1")
{
// SWAP LEFT,RIGHT CONTROLS
}
else if (other.gameObject.name == "player2")
{
// SWAP LEFT,RIGHT CONTROLS
}
}
}
I tried swapping the keys but it didnt work :
var left = Input.GetKey("a");
var right = Input.GetKey("d");
left = Input.GetKey("d");
right = Input.GetKey("a");
