how to call multiple objects via tag?

I have multiple objects with the tag “wall” i want to turn off the box collied when the mouse button is pressed and then turn them back on when it is pressed again. tried many things just doesnt seam to work.

function Update () {
var wall = GameObject.FindWithTag(“wall”);
wall.GetComponent.().isTrigger = true;
else if (Input.GetKeyUp && Input.GetKeyDown(“mouse 0”)) {
wall.GetComponent.().isTrigger = false;


if you want to call/modify objects with a tag, you want to create an array, for example (Code is C#):

GameObject[] allWalls;

then in your start, or update to find all Walls with the tag, simply do this:

allWalls = GameObject.FindGameObjectsWithTag("wall"); // Or just assign them in the inspector manually instead of doing this, but obviously you'd need 'allWalls' to be public.

to modify one specific wall, you’d do this (btw, in an array, it counts up from 0, not 1, so 0 is your first object in the array, and so on)
Say we want to make it inactive, we’d do this:

allWalls[0].SetActive(false); //the zero inside the square brackets is the element in the array you wish you modify

if you want to do that ^^ line of code for every wall in the array, dont bother doing copy paste over and over for each wall, do this instead, much faster and easier:

foreach(GameObject g in allWalls){

Hope this helps!

kind of but i dont want the object to dissapear i just want to disable the collider attached to the object