Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Button when pressed on the controller triggers the rest too.

Discussion in 'Input System' started by AdamRozanski, May 3, 2024.

  1. AdamRozanski

    AdamRozanski

    Joined:
    Apr 23, 2024
    Posts:
    2
    I am making a game about 4 players contending for an area. When pressing the interact button you're supposed to be able to spread your territory. However when a button is pressed on a controller each game object on a controller spreads its territory, given that the other requirements are met. Any ideas?


    private void PlaceFog3(GameObject instance, Witch witch)
    {

    if (!witch.IsInFog && Physics.CheckSphere(instance.transform.position, 2, _fogLayerMask) && Input.GetButtonDown("Interact 2") && !Physics.CheckSphere(_witchInstances[0].transform.position, 2, LayerMask.GetMask("Ingredient")))
    {
    GameObject fog = Instantiate(_fogPrefab, instance.transform.position, Quaternion.identity);
    witch.AddFog(fog.transform.position);
    }

    }
    private void PlaceFog4(GameObject instance, Witch witch)
    {

    if (!witch.IsInFog && Physics.CheckSphere(instance.transform.position, 2, _fogLayerMask) && Input.GetButtonDown("Interact 3") && !Physics.CheckSphere(_witchInstances[0].transform.position, 2, LayerMask.GetMask("Ingredient")))
    {
    GameObject fog = Instantiate(_fogPrefab, instance.transform.position, Quaternion.identity);
    witch.AddFog(fog.transform.position);
    }
     
  2. AdamRozanski

    AdamRozanski

    Joined:
    Apr 23, 2024
    Posts:
    2
    I found the issue. In the Input Manager I put the positive button as "Joystick button 0" on all the controllers.