Trying to disable an object in a list that collides with another object.

15543-untitled.jpgSo what I have is an object, and a list. The list is spawned continuously, while the single object spawns every once in a while.

What I would like for it do is, where ever that single object is spawned it will deactivate the correct object in the list.

The 2 platforms that are touching the object should be deactivated.

I GOT IT!!!

void despawnObjet()
	{
		foreach(GameObject p in platListSpawner)
		{
			float checkTrap1 = Vector3.Distance(p.transform.position,trapListSpawner[0].transform.position);
			float checkTrap2 = Vector3.Distance(p.transform.position,trapListSpawner[1].transform.position);
			float checkTrap3 = Vector3.Distance(p.transform.position,trapListSpawner[2].transform.position);
			
			if(checkTrap1 <= 6.0f)
			{
				p.gameObject.SetActive(false);
			}
			if(checkTrap2 <= 6.0f)
			{
				p.gameObject.SetActive(false);
			}
			if(checkTrap3 <= 6.0f)
			{
				p.gameObject.SetActive(false);
			}
			
				
		}
	}

That will check every object in the list to see if it’s near he position of the other object. If it is it will SetActive(false).