FindObjectOfType with Variable


ive been trying to figure out how to spawn my player in a multiplayer game only on my teams spawns

my code is:

public void SpawnMyPlayer ()
		SpawnBeds = GameObject.FindObjectsOfType<Vessel_SpawnBed>().Equals(;

		SpawnIslands = GameObject.FindObjectsOfType<Map_IslandSpawn>();

		Transform MySpawn;//the position where i will spawn
		//AddChatMessages("Spawning: " +;
		if (SpawnBeds != null)
			MySpawn = SpawnBeds[ Random.Range (0, SpawnBeds.Length) ];
			MySpawn = SpawnIslands[ Random.Range (0, SpawnBeds.Length) ];

		MyPlayerInfo.MyPlayer = (GameObject)PhotonNetwork.Instantiate("Player", MySpawn.transform.position, MySpawnBed.transform.rotation, 0);
		MyPlayerInfo.MyPlayer.tag = "MyPlayer";


where the line is that i find My SpawnBeds that gives me an array of all the spawn beds in the scene but i only want the spawn beds with the TeamId variable of 0

How do i do this its been stumping me for a while

thanks ~Scott

My idea:

List<Vessel_SpawnBed> SpawnBeds = new List<Vessel_SpawnBed>(); 
SpawnBeds = GameObject.FindObjectsOfType<Vessel_SpawnBed>().ToList();

SpawnBeds = SpawnBeds.FindAll(spawn => spawn.TeamdId == 0);

make sure you are

using Linq;

and make available your TeamId variable by making it public or something