Is it possible to have two 2D colliders touch and then ignore each other while still listening for collisions with other objects?

Say you have a room, with spikes on the walls and ceiling and floor. In that room is a floating object in which its movement is controlled by the player. In that same room there are other objects floating in space.

What I’m trying to accomplish is once the object you control touches a free floating object they stick together and move as one object. At the same time, if any of the single objects in the group touch a spike, it gets destroyed, leaving the other object it was once attached to intact.

I’ve tried parenting to no success. I’m new to Unity and I’m not a programmer. I’m using Bolt. I understand the basic logic of how things work so I can probably figure out any code you may type. From what I understand all I need to do is get objects to ignore each other once they collide, but only ignore each other and still look for collisions elsewhere. Once they’ve collided they need to take input from the player as if they were a single object.

The easiest solution would be to just replace the sprite with a new sprite that shows two objects instead of one, but I was hoping to give the player better interactivity by showing a specific object getting destroyed in real time. Thanks. I hope I explained it clearly enough for you.

Perhaps you are looking for Physics2D.IgnoreCollision?
The Physics.IgnoreCollision functions are intended for you to allow two objects to ignore eachother, without it ignoring an entire layer.

Here is the documentation Physics2D.IgnoreCollision
Also an example, pulled straight from the docs.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Transform bulletPrefab;
    void Start() {
        Transform bullet = Instantiate(bulletPrefab) as Transform;
        Physics2D.IgnoreCollision(bullet.GetComponent<Collider2D>(), GetComponent<Collider2D>());
    }
}

This makes it so that the instantiated bullet will ignore the object instantiating it, but obviously you can use this is any way you would need.

If you simply want an object to ignore another, and you aren’t a programmer, this will do the trick. Attach the script to the object you want to move that has a Collider2D, and drag and drop the object you want to ignore that has a Collider2D into the ignore slot on the inspector.

    using UnityEngine;
    using System.Collections;
    
    public class IgnoreCollider: MonoBehaviour {
        public Collider2D Ignore;
        void Start() {
            Physics2D.IgnoreCollision(GetComponent<Collider2D>(), Ignore);
        }
    }