Enter new level positions - check for players that might not be there

Hello unites! I travel with a party in my rpg- at times they may not be there (I recall some/ they may leave). Some of them have the same tags. How do I set it up to check if they are / are not null when I load a new level?

I have tried this in the start function for a spawn point

 Pet = GameObject.FindWithTag("Pet").transform;
   //etc finds...

 Player = GameObject.FindWithTag("Player").transform;
 cam = GameObject.FindWithTag("MainCamera").transform;

Player.position = transform.position;
Player.rotation.y = transform.rotation.y;
cam.rotation.y = transform.rotation.y;

Pet.position =transform.position+transform.right*4;
Pet.rotation.y = transform.rotation.y;

}if(Pet2 != null){
Pet2.position = transform.position+transform.right*-4;
Pet2.rotation.y = transform.rotation.y;

thanks for any help


Use player prefs.

Save what the player has... Has a int 0 = not there, 1 = there.

Then you'd have, example.

//Start game, no allies;

PlayerPrefs.SetInt("dog", 0);
PlayerPrefs.SetInt("friend", 0);
PlayerPrefs.SetInt("cat", 0);

//Next level, dog joins;

PlayerPrefs.SetInt("dog", 1);
PlayerPrefs.SetInt("friend", 0);
PlayerPrefs.SetInt("cat", 0);

//Next level, dog leaves, both cat and friend comes in.

PlayerPrefs.SetInt("dog", 0);
PlayerPrefs.SetInt("friend", 1);
PlayerPrefs.SetInt("cat", 1);


Then at beginning of map, just use:

int dog = PlayerPrefs.GetInt("dog");
int friend = PlayerPrefs.GetInt("friend");
int cat = PlayerPrefs.GetInt("cat");

function Awake() {
    if(dog = 1){
        //Spawn dog.
    if(friend = 1){
        //Spawn friend.
    if(cat = 1){
        //Spawn cat.

That should work =). Good luck!