Detect collision on subGameObjects

I have a wall in my project and a player. Player has a Rigidbody and a Sphere Collider which is a trigger. My wall has a box collider (trigger) and a script with:

void OnTriggerEnter (Collider col){
		
       if (col.gameObject.name == "Ballmodel"){

			switch (PackmanMoving.movementDirection)
			{
			case 1:
				PackMan.transform.Translate(0, 0, -0.05f);
				PackmanMoving.movementDirection = 0;
				break;
			case 2:
				PackMan.transform.Translate(-0.05f, 0, 0);
				PackmanMoving.movementDirection = 0;
				break;
			case 3:
				PackMan.transform.Translate(0, 0, 0.05f);
				PackmanMoving.movementDirection = 0;
				break;
			case 4:
				PackMan.transform.Translate(0.05f, 0, 0);
				PackmanMoving.movementDirection = 0;
				break;
			}
		}
	}

Pressing Uparrow key sets movementDirection to an integer and a player starts moving in speed of deltatime. When a player hits a wall that has a OnTriggerEnter script attached, it stops and gets back little from the wall. I have around 100 walls in my project which are inside of a gameObject named Walls. If I put my OnTriggerEnter script on Walls, it doesn’t work. However if I put that script on one wall and move into it, the player stops.

How do I make player stop to all walls that are under gameobject Walls? Full scripts:

WallCollision: using UnityEngine;using System.Collections;public class WallCollision : Mo - Pastebin.com
PackmanMoving: using UnityEngine;using System.Collections;public class PackmanMoving : Mo - Pastebin.com

The problem is that your “walls” object does not have the collider thats why your OnTriggerEnter() is not being called when you attach the script with “walls”. You can attach your script either on your player or on each wall which has box collider .The OnTriggerEnter() is being called up only when the object on which the script is attached has a collider.

create a empty game object and add box Collider to it and put it under he wall as child to wall. if u r walls are continuous on change a size of the game object to cover it for all the walls or add it for individual.
be-careful: if wall are individual create many game object and do the above and dont let two collider intersect with eachother. add the same script that u write to every empty gameobject and try it

if u dont understand try this

17. Unity Tutorial, DOORS - Create a Survival Game - YouTube click here