removing gameobject from list in other script

hello

I have 2 scripts one is called Characterdamage and the other one is called zombiewinkelchecker

what i wanna do is when an enemy dies in characterdamage it will be removed from the list in zombiewinkelchecker.

But i dont know how to do that

Hope someone can help
Zombiewinkelchecker.cs

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class zombiewinkelchecker : MonoBehaviour {

    public List<GameObject> enemies = new List<GameObject>();

    // Use this for initialization
    void Start () {
 
    }
 
    // Update is called once per frame
    void Update () {
        //print(enemies.Count);
        //if(enemies.Count == 0)
        //{
        //    Debug.Log("geen zombies over");
//
       // }
         if (Input.GetKey(KeyCode.M))
         {
             //enemies.RemoveAt;
         }
    }
}

charachterdamge.cs

if (hitPoints <= 0.0f){
            SendMessage("Die");
            Debug.Log("dood");
//here it needs to delete that enemy from the list the list called enemies in zombiewinkelchecker
        }

There are number of ways to solve this. I’m not sure which way you are expecting but here is one approach to let you start with. You need to give more details as some parts are not much clear.

Here, I assume zombiewinkelchecker is the one which has the list of zombieCharacters created and charachterdamge is the script that got added to each Zombie character to check if its dead or not.

Using Transform.parent:

  1. Create a fresh GameObject and add zombiewinkelchecker to it.

  2. When creating the zombie characters, attach each zombie character as the child of above created GameObject.
    zombieCharacterGO.transform.parent = zombiewinkelcheckerGO.tranform; // here for later part u can just use transform as you will create in that script only.

  3. Now when ever you see its right time for death of character,
    transform.parent.GetComponent().Remove(this.gameObject); //Remove is the method to remove the character from the maintained list.

If you aren’t clear of the steps let me know.