How make a local list refer to another public list?

OnTrigger do not update the lists.

public class PlayerBattleship : MonoBehaviour, UnitInterface
{
    [Header("Move check box")]
    public List<Transform> MoveCheckBoxTop = new List<Transform>();   
    public List<Transform> MoveCheckBoxBottom=new List<Transform>();
    public List<Transform> MoveCheckBoxLeft=new List<Transform>();
    public List<Transform> MoveCheckBoxRight=new List<Transform>();
    public List<Transform> MoveCheckBoxFront=new List<Transform>();
    public List<Transform> MoveCheckBoxBack=new List<Transform>();
public class BattlesshipMoveCheckBox : MonoBehaviour
{
    public Transform battleship;

    List<Transform> referList;
   
    private void Awake()
    {
        PlayerBattleship bs= transform.root.GetComponent<BattlesshipMoveCheckBox>().battleship.GetComponent<PlayerBattleship>();

        if (transform.name.Contains("Top"))
            referList = bs.MoveCheckBoxTop;
        else if (transform.name.Contains("Bottom"))
            referList = bs.MoveCheckBoxBottom;

        else if (transform.name.Contains("Left"))
            referList = bs.MoveCheckBoxLeft;
        else if (transform.name.Contains("Right"))
            referList = bs.MoveCheckBoxRight;

        else if (transform.name.Contains("Front"))
            referList = bs.MoveCheckBoxFront;
        else if (transform.name.Contains("Back"))
            referList = bs.MoveCheckBoxBack;
    }

    private void FixedUpdate()
    {
        if (battleship != null)
        {
            transform.position = battleship.position;
            transform.rotation = battleship.rotation;
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        Debug.Log(other);
        if (!referList.Contains(other.transform.root))
            referList.Add(other.transform.root);
       
    }
    private void OnTriggerExit(Collider other)
    {
        Debug.Log(Time.time+"R " + other);
        if (referList.Contains(other.transform.root))
            referList.Remove(other.transform.root);
    }

}

What you have should work, assuming the object hierarchy is set up the way Awake is expecting. What makes you think it’s not working? Do you have any errors? Where are you looking to verify if it is or isn’t working?

I just find out it is the missing rigidbody :slight_smile: