saving objects with properties in a c# list

hi guys , i’m trying to develop a game in which you’r driving a car convoy and adding members to the convoy . I want to add the new convoy members in a list and want to add properties to them like health points, armor etc. , how can i manage that and what type of list is needed for this?

Create a class to define your ConvoyMember properties.

Use 1 to easily add and remove members.

using UnityEngine;

public class ConvoyMember : MonoBehaviour
{
    public string firstName = "John";
    public string lastName = "Doe";
    public string address = "Unity Help Room";
    public Sprite icon = null;
    public float health = 100;
    public float armor = 100;
    
    public override string ToString()
    {
        return firstName + " " + lastName + " from " + address;
    }
}

Keep your members in your Convoy for instance.

using UnityEngine;
using System.Collections.Generic;

public class Convoy : MonoBehaviour
{
    public List<ConvoyMember> members = new List<ConvoyMember>();

    public void LogAllMembers()
    {
        foreach (var member in members)
            print(member);
    }
}