Ok, so i can move my player with my xbox controller. But what if i want to controll 2 different players with 2 different xbox controllers on the the same computer?
Any help apreciated
Ok, so i can move my player with my xbox controller. But what if i want to controll 2 different players with 2 different xbox controllers on the the same computer?
Any help apreciated
Hi, I am no expert on this, but this may answer your question.
if not here is my suggestion, make two game objects that receive input from two different ports on the computer, then send messages (like UpButtonDown as a public bool and turning it on and of in the player script). Then you would just make two players and only access the script on the player you want to. like this.
Component Player1;
Component player2;
// Use this for initialization
void Start () {
player2 = gameObject.GetComponent<ScriptNameHere>();
Player1 = gameObject.GetComponent<ScriptNameHere>();
}
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.Joystick1Button1))
{
Player1.BoolName = true;
}
else { Player1.BoolName = false; }
}
}
just pretend you have another script that has “BoolName”, and whenever it is false the player the script is attached to moves forward.